Class UnmanagedEnumClass<TSource, TObject>
A class which allows langword_csharp_unmanaged data implicit conversions.
Can be used along with langword_csharp_unmanaged, means it doesn't require another UnmanagedEnumClass<TSource, TObject> instance to be comparable or usable.
Inheritance
Implements
Inherited Members
Namespace: Exiled.API.Features.Core.Generic
Assembly: Exiled.API.dll
Syntax
public abstract class UnmanagedEnumClass<TSource, TObject> : IComparable, IEquatable<TObject>, IComparable<TObject>, IComparer<TObject> where TSource : struct, IComparable, IFormattable, IConvertible, IComparable<TSource>, IEquatable<TSource> where TObject : UnmanagedEnumClass<TSource, TObject>
Type Parameters
Name | Description |
---|---|
TSource | The type of the langword_csharp_unmanaged source object to handle the instance of. |
TObject | The type of the child object to handle the instance of. |
Constructors
| Improve this Doc View SourceUnmanagedEnumClass(TSource)
Initializes a new instance of the UnmanagedEnumClass<TSource, TObject> class.
Declaration
protected UnmanagedEnumClass(TSource value)
Parameters
Type | Name | Description |
---|---|---|
TSource | value | The value of the unmanaged item. |
Properties
| Improve this Doc View SourceName
Gets the name determined from reflection.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Value
Gets the value of the enum item.
Declaration
public TSource Value { get; }
Property Value
Type | Description |
---|---|
TSource |
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 SourceCast(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. |
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. |
Cast<T>(TSource)
Casts the specified value
to the corresponding type.
Declaration
public static T Cast<T>(TSource value)
where T : TObject
Parameters
Type | Name | Description |
---|---|---|
TSource | value | The enum value to be cast. |
Returns
Type | Description |
---|---|
T | The cast |
Type Parameters
Name | Description |
---|---|
T | The type to cast the enum to. |
Cast<T>(IEnumerable<TSource>)
Casts the specified values
to the corresponding type.
Declaration
public static IEnumerable<T> Cast<T>(IEnumerable<TSource> values)
where T : TObject
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | values | The enum values to be cast. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | The cast |
Type Parameters
Name | Description |
---|---|
T | The type to cast the enum to. |
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. |
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. |
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. |
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. |
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
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
GetValues(Type)
Retrieves an array of the values of the constants in a specified UnmanagedEnumClass<TSource, TObject>.
Declaration
public static TSource[] GetValues(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The UnmanagedEnumClass<TSource, TObject> type. |
Returns
Type | Description |
---|---|
TSource[] | An array of the values of the constants in a specified UnmanagedEnumClass<TSource, TObject>. |
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 |
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 |
Returns
Type | Description |
---|---|
System.Boolean | true if the |
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 |
Returns
Type | Description |
---|---|
System.Boolean | true if the |
ToString()
Converts the UnmanagedEnumClass<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 UnmanagedEnumClass<TSource, TObject> instance. |
Overrides
Operators
| Improve this Doc View SourceImplicit(TSource to UnmanagedEnumClass<TSource, TObject>)
Implicitly converts the TSource
to EnumClass<TSource, TObject>.
Declaration
public static implicit operator UnmanagedEnumClass<TSource, TObject>(TSource value)
Parameters
Type | Name | Description |
---|---|---|
TSource | value | The value to convert. |
Returns
Type | Description |
---|---|
UnmanagedEnumClass<TSource, TObject> |
Implicit(UnmanagedEnumClass<TSource, TObject> to TSource)
Implicitly converts the UnmanagedEnumClass<TSource, TObject> to TSource
.
Declaration
public static implicit operator TSource(UnmanagedEnumClass<TSource, TObject> value)
Parameters
Type | Name | Description |
---|---|---|
UnmanagedEnumClass<TSource, TObject> | value | The value to convert. |
Returns
Type | Description |
---|---|
TSource |
Implicit(UnmanagedEnumClass<TSource, TObject> to TObject)
Implicitly converts the UnmanagedEnumClass<TSource, TObject> to TObject
.
Declaration
public static implicit operator TObject(UnmanagedEnumClass<TSource, TObject> value)
Parameters
Type | Name | Description |
---|---|---|
UnmanagedEnumClass<TSource, TObject> | value | The value to convert. |
Returns
Type | Description |
---|---|
TObject |