Convert to Constant
In This Article
Converts the string variable or field under the cursor to a constant.
#Purpose
Convert to Constant is great when you have a string variable or a field whose value never changes. Using constants makes your code safer.
#Availability
Available from the context menu or via shortcuts:
- when the cursor is on a string variable or field declaration with initialization, provided that its value is never changed.
#Example
string │_MyString = "MyString";
Private │_MyString As String = "MyString"
Result:
const string _MyString = "MyString";
Private Const _MyString As String = "MyString"