Allows you to specify an abbreviation for an item. Useful for Enumerations.
Inheritance
AbbreviationAttribute
[AttributeUsage(AttributeTargets.Field)]
public class AbbreviationAttribute : Attribute, _Attribute
Constructors
Declaration
public AbbreviationAttribute(string newAbbreviation)
Parameters
Type |
Name |
Description |
String |
newAbbreviation |
|
Fields
Declaration
public readonly string Abbreviation
Field Value
Methods
Returns the object from the abbreviation.
Declaration
public static TBaseType FindAbbreviation<TBaseType>(string abbreviation, bool ignoreCase)
Parameters
Returns
Type |
Description |
TBaseType |
|
Type Parameters
Name |
Description |
TBaseType |
|
Returns the abbreviation from an item that should be marked with the AbbreviationAttribute.
For example, GetAbbreviation(States.California) = "CA"
Declaration
public static string GetAbbrevation(object value)
Parameters
Type |
Name |
Description |
Object |
value |
|
Returns
Searches for the object from the abbreviation
Declaration
public static bool TryFindAbbreviation<TBaseType>(string abbreviation, bool ignoreCase, ref TBaseType result)
Parameters
Type |
Name |
Description |
String |
abbreviation |
|
Boolean |
ignoreCase |
|
TBaseType |
result |
|
Returns
Type Parameters
Name |
Description |
TBaseType |
|