Search Results for

    Show / Hide Table of Contents

    Class EnumClass<TSource, TObject>

    A class which allows System.Enum implicit conversions.

    Can be used along with System.Enum, means it doesn't require another EnumClass<TSource, TObject> instance to be comparable or usable.

    Inheritance
    System.Object
    EnumClass<TSource, TObject>
    Implements
    System.IComparable
    System.IEquatable<TObject>
    System.IComparable<TObject>
    System.Collections.Generic.IComparer<TObject>
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Exiled.API.Features.Core.Generic
    Assembly: Exiled.API.dll
    Syntax
    public abstract class EnumClass<TSource, TObject> : IComparable, IEquatable<TObject>, IComparable<TObject>, IComparer<TObject> where TSource : Enum where TObject : EnumClass<TSource, TObject>
    Type Parameters
    Name Description
    TSource

    The type of the source object to handle the instance of.

    TObject

    The type of the child object to handle the instance of.

    Constructors

    | Improve this Doc View Source

    EnumClass(TSource)

    Initializes a new instance of the EnumClass<TSource, TObject> class.

    Declaration
    protected EnumClass(TSource value)
    Parameters
    Type Name Description
    TSource value

    The value of the enum item.

    Properties

    | Improve this Doc View Source

    Name

    Gets the name determined from reflection.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Value

    Gets the value of the enum item.

    Declaration
    public TSource Value { get; }
    Property Value
    Type Description
    TSource
    | Improve this Doc View Source

    Values

    Gets all TObject object instances.

    Declaration
    public static IEnumerable<TObject> Values { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<TObject>

    Methods

    | Improve this Doc View Source

    Cast(TSource)

    Casts the specified value to the corresponding type.

    Declaration
    public static TObject Cast(TSource value)
    Parameters
    Type Name Description
    TSource value

    The enum value to be cast.

    Returns
    Type Description
    TObject

    The cast object.

    | Improve this Doc View Source

    Cast(IEnumerable<TSource>)

    Casts the specified values to the corresponding type.

    Declaration
    public static IEnumerable<TObject> Cast(IEnumerable<TSource> values)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TSource> values

    The enum values to be cast.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TObject>

    The cast object.

    | Improve this Doc View Source

    Compare(TObject, TObject)

    Compares the specified object 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.

    Declaration
    public int Compare(TObject x, TObject y)
    Parameters
    Type Name Description
    TObject x

    An object to compare.

    TObject y

    Another object to compare.

    Returns
    Type Description
    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 other in the sort order. Zero This instance occurs in the same position in the sort order as other. Greater than zero This instance follows other in the sort order.

    | Improve this Doc View Source

    CompareTo(TObject)

    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.

    Declaration
    public int CompareTo(TObject other)
    Parameters
    Type Name Description
    TObject other

    An object to compare with this instance.

    Returns
    Type Description
    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 other in the sort order. Zero This instance occurs in the same position in the sort order as other. Greater than zero This instance follows other in the sort order.

    | Improve this Doc View Source

    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.

    Declaration
    public int CompareTo(object obj)
    Parameters
    Type Name Description
    System.Object obj

    An object to compare with this instance.

    Returns
    Type Description
    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 other in the sort order. Zero This instance occurs in the same position in the sort order as other. Greater than zero This instance follows other in the sort order.

    | Improve this Doc View Source

    Equals(TObject)

    Determines whether the specified object is equal to the current object.

    Declaration
    public bool Equals(TObject other)
    Parameters
    Type Name Description
    TObject other

    The object to compare.

    Returns
    Type Description
    System.Boolean

    true if the object was equal; otherwise, false.

    | Improve this Doc View Source

    Equals(Object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    The object to compare.

    Returns
    Type Description
    System.Boolean

    true if the object was equal; otherwise, false.

    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    GetHashCode()

    Returns a the 32-bit signed hash code of the current object instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    The 32-bit signed hash code of the current object instance.

    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    GetValues(Type)

    Retrieves an array of the values of the constants in a specified EnumClass<TSource, TObject>.

    Declaration
    public static TSource[] GetValues(Type type)
    Parameters
    Type Name Description
    System.Type type

    The EnumClass<TSource, TObject> type.

    Returns
    Type Description
    TSource[]

    An array of the values of the constants in a specified EnumClass<TSource, TObject>.

    | Improve this Doc View Source

    Parse(String)

    Parses a System.String object.

    Declaration
    public static TObject Parse(string obj)
    Parameters
    Type Name Description
    System.String obj

    The object to be parsed.

    Returns
    Type Description
    TObject

    The corresponding TObject object instance, or null if not found.

    | Improve this Doc View Source

    SafeCast(TSource, out TObject)

    Safely casts the specified value to the corresponding type.

    Declaration
    public static bool SafeCast(TSource value, out TObject result)
    Parameters
    Type Name Description
    TSource value

    The enum value to be cast.

    TObject result

    The cast value.

    Returns
    Type Description
    System.Boolean

    true if the value was cast; otherwise, false.

    | Improve this Doc View Source

    SafeCast(IEnumerable<TSource>, out IEnumerable<TObject>)

    Safely casts the specified values to the corresponding type.

    Declaration
    public static bool SafeCast(IEnumerable<TSource> values, out IEnumerable<TObject> results)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TSource> values

    The enum value to be cast.

    System.Collections.Generic.IEnumerable<TObject> results

    The cast values.

    Returns
    Type Description
    System.Boolean

    true if the values was cast; otherwise, false.

    | Improve this Doc View Source

    ToString()

    Converts the EnumClass<TSource, TObject> instance to a human-readable System.String representation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A human-readable System.String representation of the EnumClass<TSource, TObject> instance.

    Overrides
    System.Object.ToString()

    Operators

    | Improve this Doc View Source

    Implicit(TSource to EnumClass<TSource, TObject>)

    Implicitly converts the TSource to EnumClass<TSource, TObject>.

    Declaration
    public static implicit operator EnumClass<TSource, TObject>(TSource value)
    Parameters
    Type Name Description
    TSource value

    The value to convert.

    Returns
    Type Description
    EnumClass<TSource, TObject>
    | Improve this Doc View Source

    Implicit(EnumClass<TSource, TObject> to TSource)

    Implicitly converts the EnumClass<TSource, TObject> to TSource.

    Declaration
    public static implicit operator TSource(EnumClass<TSource, TObject> value)
    Parameters
    Type Name Description
    EnumClass<TSource, TObject> value

    The value to convert.

    Returns
    Type Description
    TSource
    | Improve this Doc View Source

    Implicit(EnumClass<TSource, TObject> to TObject)

    Implicitly converts the EnumClass<TSource, TObject> to TObject.

    Declaration
    public static implicit operator TObject(EnumClass<TSource, TObject> value)
    Parameters
    Type Name Description
    EnumClass<TSource, TObject> value

    The value to convert.

    Returns
    Type Description
    TObject

    Implements

    System.IComparable
    System.IEquatable<T>
    System.IComparable<T>
    System.Collections.Generic.IComparer<T>

    Extension Methods

    ReflectionExtensions.CopyProperties(Object, Object)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX