Class NameUtil
Utility class for handling object names and display names.
public static class NameUtil
- Inheritance
-
NameUtil
- Inherited Members
Fields
UnsetText
Default text used when a name is not set.
public const string UnsetText = "Unset"
Field Value
Methods
GetSelectionName(object)
Gets the selection name for an object, using custom implementation if available, or falling back to type display name or type name.
public static string GetSelectionName(this object src)
Parameters
srcobjectThe source object to get the name for
Returns
- string
The selection name for the object
GetSelectionName(Type)
Gets the selection name for a type, using its DisplayName attribute if available, or falling back to the type name.
public static string GetSelectionName(this Type type)
Parameters
typeTypeThe type to get the name for
Returns
- string
The selection name for the type
SpacePascalWords(string)
Spaces a PascalCase member name into display words: an underscore
suffix is dropped and a space is inserted before each capital that
starts a new word, so MachiningResolution_mm becomes
“Machining Resolution” and ReadOnFirstOrWrite becomes
“Read On First Or Write”. Consecutive capitals stay one word.
public static string SpacePascalWords(string name)
Parameters
namestringThe member name to space.
Returns
- string
The spaced display words.