System.Reflection.FieldInfo.IsInitOnly Property

Gets a value indicating whether the field can only be set in the body of the constructor.

Syntax

public bool IsInitOnly { get; }

Value

Documentation for this section has not yet been entered.

Remarks

If the returned value is true, the field can only be initialized, and is read-only thereafter.

To get the IsInitOnly property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsInitOnly property. To access a non-public field, combine BindingFlags.NonPublic with either or both of BindingFlags.Static and BindingFlags.Instance in the GetField method.

The IsInitOnly property is set when the FieldAttributes.InitOnly attribute is set.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0