Class StringEnumeration
A Smart Enumeration class that includes additional 'Batteries' to enhance a standard enumeration. References: https://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/
Namespace: Workspace.XBR.Xperiflow.Utilities.Text
Assembly: Xperiflow.dll
[JsonConverter(typeof(StringEnumerationConverter))]
public abstract class StringEnumeration : IComparable
Derived:
Expand
Workspace.XBR.Xperiflow.Core.Pagination.XperiflowPaginationExpressions, Workspace.XBR.Xperiflow.Core.Pagination.XperiflowPaginationOperators, Workspace.XBR.Xperiflow.Routines.Instances.RoutineInstanceFields, Workspace.XBR.Xperiflow.Routines.RoutineCallableType, Workspace.XBR.Xperiflow.Routines.RoutineTypeFields, Workspace.XBR.Xperiflow.Routines.Runs.ExecutionActivityStatusType, Workspace.XBR.Xperiflow.Routines.Runs.InvocationMethodType, Workspace.XBR.Xperiflow.Routines.Runs.RunMetadataInfoFields, Workspace.XBR.Xperiflow.Utilities.File.FileStorageTypes, Workspace.XBR.Xperiflow.Utilities.Text.StringFormatter.StringConversionTypes, Workspace.XBR.Xperiflow.VersionManagement.DependencyType
Implements:
System.IComparable
Properties
Value
public int Value { get; }
DisplayName
public string DisplayName { get; }
Methods
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
System.String
A string that represents the current object.
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Returns
System.Boolean
true if the specified object is equal to the current object; otherwise, false.
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with the current object. |
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
System.Int32
A hash code for the current object.
GetAll<T>()
Provides an iterator to iterate over all StringEnumeration constants.
public static IEnumerable<T> GetAll<T>() where T : StringEnumeration, new()
Returns
System.Collections.Generic.IEnumerable<{T}>
Type Parameters
T
AbsoluteDifference(StringEnumeration, StringEnumeration)
public static int AbsoluteDifference(StringEnumeration firstValue, StringEnumeration secondValue)
Returns
System.Int32
Parameters
Type | Name |
---|---|
Workspace.XBR.Xperiflow.Utilities.Text.StringEnumeration | firstValue |
Workspace.XBR.Xperiflow.Utilities.Text.StringEnumeration | secondValue |
FromValue<T>(int)
Creates a StringEnumeration Type from an expected value.
public static T FromValue<T>(int value) where T : StringEnumeration, new()
Returns
<T>
Parameters
Type | Name |
---|---|
System.Int32 | value |
Type Parameters
T
FromDisplayName<T>(string)
Creates a StringEnumeration Type from an expected display name.
public static T FromDisplayName<T>(string displayName) where T : StringEnumeration, new()
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | displayName |
Type Parameters
T
Contains<T>(T)
Determines if the specified value is contained within the set of StringEnumeration constants.
public static bool Contains<T>(T value) where T : StringEnumeration, new()
Returns
System.Boolean
Parameters
Type | Name |
---|---|
<T> | value |
Type Parameters
T
DisplayNames<T>()
Retrieves all display names for the StringEnumeration constants.
public static List<string> DisplayNames<T>() where T : StringEnumeration, new()
Returns
System.Collections.Generic.List<System.String>
List of display names.
Type Parameters
Name | Description |
---|---|
T | Type of StringEnumeration. |
HasDisplayName<T>(string)
Checks if the given display name exists in the set of StringEnumeration constants.
public static bool HasDisplayName<T>(string displayName) where T : StringEnumeration, new()
Returns
System.Boolean
True if the display name exists, otherwise false.
Parameters
Type | Name | Description |
---|---|---|
System.String | displayName | Display name to check. |
Type Parameters
Name | Description |
---|---|
T | Type of StringEnumeration. |
ToDataTable<T>()
Converts the String Enumeration options to a DataTable Example: Dim myDataTable = StringEnumeration.ToDataTable(Of ConcreteStringEnum)()
public static DataTable ToDataTable<T>() where T : StringEnumeration, new()
Returns
System.Data.DataTable
Type Parameters
T
CompareTo(object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object obj)
Returns
System.Int32
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj. Greater than zero This instance follows obj in the sort order.
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | An object to compare with this instance. |
Exceptions
System.ArgumentException
obj is not the same type as this instance.
Implements
System.IComparable
Inherited Members
System.Object.Equals(System.Object,System.Object)
System.Object.GetType
System.Object.MemberwiseClone
System.Object.ReferenceEquals(System.Object,System.Object)