241.
struct MyStruct
{
public int x = 10;
public int y = 30;
}
class MyClient
{
public static void Main()
{
MyStruct ms = new MyStruct();
int sum = ms.x + ms.y;
Console.WriteLine("The sum is {0}", sum);
}
}
View Description
It is an error to initialize an instance field in a struct.
'MyStruct.x': cannot have instance field initializers in structs
'MyStruct.y': cannot have instance field initializers in structs