Accessing Structures with Properties and Public Members
public struct StructWithPublicMembers {
public int X;
public int Y;
}
public struct StructWithProperties {
private int PrivateX;
private int PrivateY;
public int X {
get {
return PrivateX;
}
set {
PrivateX = value;
}
}
public int Y {
get {
return PrivateY;
}
set {
PrivateY = value;
}
}
}
public class MainClass {
public static void Main() {
StructWithPublicMembers MembersStruct;
StructWithProperties PropertiesStruct = new StructWithProperties() ;
MembersStruct.X = 100;
MembersStruct.Y = 200;
PropertiesStruct.X = 100;
PropertiesStruct.Y = 200;
}
}