I'm a newbie with mono. This is my second C# script I've ever made with it:
Code: Select all
using System;
namespace RectangleApplication {
class Rectangle {
// member variables
double length;
double width;
public void Acceptdetails() {
length = 4.5;
width = 3.5;
}
public double GetArea() {
return length * width;
}
public void Display() {
Console.WriteLine("Length: {0}", length);
Console.WriteLine("Width: {0}", width);
Console.WriteLine("Area: {0}", GetArea());
}
}
class ExecuteRectangle {
static void Main(string[] args) {
Rectangle r = new Rectangle();
r.Acceptdetails();
r.Display();
Console.ReadLine();
}
}
}
- Length: 4.5
Width: 3.5
Area: 15.75
But if I put this line and its square brackets into comments
Code: Select all
/*namespace RectangleApplication {
}*/
Is there some package I should add to have namespace declaration option? How necessary that is? Or should I care about it at all?
If I make a program for Windows which has no namespace declaration?