Make Read-Only

Converts the field under the cursor to a read-only field.

Availability

Available from the context menu or via shortcuts:

  • when the cursor is on a field declaration, provided that its value never changes.

Example

private int _MyField;
Private _MyField As Integer

Result:

private readonly int _MyField;
Private ReadOnly _MyField As Integer

Screenshot

CSharpMakeReadOnly