I am writing a class which holds 90 integer variables. There are basically 10, but each has 3×3 attributes, making them 90. I’ll explain it further.
So the 10 variables I have are: v0, v1, v2, …, v9. Each of these has three different values, for city, county and state. Also, each of these has three different values for past, present and future.
So, a typical value would be: v3.City.Future or v7.State.Past or v8.County.Present.
I was thinking to implement a class, with 10 structs for each variable, then each of those struct has a three nested structs (for city, county and state) and each of those structs has three integer variables for past, present and future.
This is still in the conceptual phase. I tried to go with the above mentioned approach, but it is not working.
Here is the code snippet:
public class MyClass
{
public MyVariable myvariable;
}
public struct MyVariable
{
public struct National
{
public int Past { get; set; }
public int Present { get; set; }
public int Future { get; set; }
}
...
}
Now when I instantiate the class and access the member (myclass.myvariable.National.Past), it does not get the member.
Here is the answer to this:
Now the class will be:
Once I instantiate an object of the class, I can refer it to like this: