In Java
instance variables can be initialized by an initialization block as shown below:
class Example {
private int varOne;
private int varTwo;
{
// Instance Initializer
varOne = 42;
varTwo = 256;
}
}
Is there an equivalent construct in C#
?
[Edit] I know that this can be inline with the instance variable declaration. However, I am looking for is something similar to the static constructor in C#
but for instance variables.