nitialization of structures without any constructor in C#
Forums:
var rect = new Rectangle {
size = new Size { width = 10, height = 10 },
point = new Point { top = 5, left = 5 }
};
struct Size {
public int width, height;
}
struct Point {
public int top, left;
}
struct Rectangle {
public Size size;
public Point point;
}
- Log in to post comments