Is there a way I can create a static array with readonly values, but using some logic to create it? Let me try to explain:
I know I can do this:
public static readonly int[] myArray = { 1, 2, 3 };
but is it possible to do something like:
public static readonly int[] myArray2 =
{
for (int i = 0; i < 256; i++)
{
float[i] = i;
}
};
EDITED:
A good solution to my question: Static Constructor! http://msdn.microsoft.com/en-us/library/k9x6w0hc%28v=VS.100%29.aspx 😀
What you can do is:
Or: