In Java I can write:
public final static MyClass foo = new MyClass("foo");
is there an equivalent in C#?
In Java I can write:
public final static MyClass foo = new MyClass("foo");
is there an equivalent in C#?
The closest thing (not exactly the same, final
has other meanings too) for Java final
fields I can think of is readonly
:
public static readonly MyClass field = new MyClass("foo");