Convert Field to Property

Top  Previous  Next

The Convert Field to Property feature allows you to easily convert a field of a class such as:

[C#]

 

public int Count;

[VB.NET]

 

Public Count As Integer

into a property such as:

[C#]

 

private int m_iCount;

 

public int Count

{

get

{

return m_iCount;

}

set

{

m_iCount = value;

}

}

[VB.NET]

 

Private m_iCount As Integer

 

Public Property Count() As Integer

 

Get

Return m_iCount

End Get

 

Set(ByVal Value As Integer)

m_iCount = Value

End Set

 

End Property

Once you have put the cursor on the line with the field declaration, MZ-Tools offers the following ways to convert it to a property:

  • The MZ-Tools | Convert Field To Property... menu.
  • The MZ-Tools | Convert Field To Property... context menu of a code window.
  • The Convert Field To Property... button on the MZ-Tools toolbar.
  • The keyboard shortcut associated with the MZTools6_VSXXXX.ConvertFieldToProperty command.

Then, the line under the cursor will be parsed and the proper values will be filled in the New Procedure Assistant dialog. When you click the Add button, the field declaration is converted to a property.

Remarks:

  • You can customize the nomenclature preferences for member variables in the Corporate Options window, Nomenclature section.
  • This feature is not available for the C++ language.

See Also:

New Procedure Assistant

Nomenclature Options

Keyboard Shortcuts Options