Dlaczego to zadziała:
namespace ConsoleApplication1
{
class Rectangle
{
public Rectangle(Point left, Point right)
{
TopLeft = left;
BottomRight = right;
}
public Point TopLeft
{
get { return topLeft; }
set { topLeft = value; }
}
public Point BottomRight
{
get { return bottomRight; }
set { bottomRight = value; }
}
public void DisplayStats()
{
Console.WriteLine("[TopLeft: {0}, {1}, {2} BottomRight: {3}, {4}, {5}]", topLeft.X, topLeft.Y, topLeft.Color,
bottomRight.X, bottomRight.Y, bottomRight.Color);
}
}
}
A to już nie ?
namespace ConsoleApplication1
{
class Rectangle
{
public Rectangle(Point left, Point right)
{
TopLeft = left;
BottomRight = right;
}
public Point TopLeft
{
get;
set;
}
public Point BottomRight
{
get;
set;
}
public void DisplayStats()
{
Console.WriteLine("[TopLeft: {0}, {1}, {2} BottomRight: {3}, {4}, {5}]", topLeft.X, topLeft.Y, topLeft.Color,
bottomRight.X, bottomRight.Y, bottomRight.Color);
}
}
}
Chodzi o to, że program działa, ale nie wyświetla danych rectangle.