Table of Contents

Class UnmanagedEnumClass<TSource, TObject>

Namespace
Exiled.API.Features.Core.Generic
Assembly
Exiled.API.dll

A class which allows unmanaged data implicit conversions.

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

public abstract class UnmanagedEnumClass<TSource, TObject> : IComparable, IEquatable<TObject>, IComparable<TObject>, IComparer<TObject> where TSource : unmanaged, IComparable, IFormattable, IConvertible, IComparable<TSource>, IEquatable<TSource> where TObject : UnmanagedEnumClass<TSource, TObject>

Type Parameters

TSource

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

TObject

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

Inheritance
UnmanagedEnumClass<TSource, TObject>
Implements
IEquatable<TObject>
IComparable<TObject>
IComparer<TObject>
Inherited Members
Extension Methods

Constructors

UnmanagedEnumClass(TSource)

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

protected UnmanagedEnumClass(TSource value)

Parameters

value TSource

The value of the unmanaged item.

Properties

Name

Gets the name determined from reflection.

public string Name { get; }

Property Value

string

Value

Gets the value of the enum item.

public TSource Value { get; }

Property Value

TSource

Values

Gets all TObject object instances.

public static IEnumerable<TObject> Values { get; }

Property Value

IEnumerable<TObject>

Methods

Cast(IEnumerable<TSource>)

Casts the specified values to the corresponding type.

public static IEnumerable<TObject> Cast(IEnumerable<TSource> values)

Parameters

values IEnumerable<TSource>

The enum values to be cast.

Returns

IEnumerable<TObject>

The cast object.

Cast(TSource)

Casts the specified value to the corresponding type.

public static TObject Cast(TSource value)

Parameters

value TSource

The enum value to be cast.

Returns

TObject

The cast object.

Cast<T>(IEnumerable<TSource>)

Casts the specified values to the corresponding type.

public static IEnumerable<T> Cast<T>(IEnumerable<TSource> values) where T : TObject

Parameters

values IEnumerable<TSource>

The enum values to be cast.

Returns

IEnumerable<T>

The cast T object.

Type Parameters

T

The type to cast the enum to.

Cast<T>(TSource)

Casts the specified value to the corresponding type.

public static T Cast<T>(TSource value) where T : TObject

Parameters

value TSource

The enum value to be cast.

Returns

T

The cast T object.

Type Parameters

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.

public int Compare(TObject x, TObject y)

Parameters

x TObject

An object to compare.

y TObject

Another object to compare.

Returns

int

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.

public int CompareTo(object obj)

Parameters

obj object

An object to compare with this instance.

Returns

int

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.

public int CompareTo(TObject other)

Parameters

other TObject

An object to compare with this instance.

Returns

int

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(object)

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

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the object was equal; otherwise, false.

Equals(TObject)

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

public bool Equals(TObject other)

Parameters

other TObject

The object to compare.

Returns

bool

true if the object was equal; otherwise, false.

GetHashCode()

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

public override int GetHashCode()

Returns

int

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

GetValues(Type)

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

public static TSource[] GetValues(Type type)

Parameters

type Type

The UnmanagedEnumClass<TSource, TObject> type.

Returns

TSource[]

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

Parse(string)

Parses a string object.

public static TObject Parse(string obj)

Parameters

obj string

The object to be parsed.

Returns

TObject

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

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

Safely casts the specified values to the corresponding type.

public static bool SafeCast(IEnumerable<TSource> values, out IEnumerable<TObject> results)

Parameters

values IEnumerable<TSource>

The enum value to be cast.

results IEnumerable<TObject>

The cast values.

Returns

bool

true if the values was cast; otherwise, false.

SafeCast(TSource, out TObject)

Safely casts the specified value to the corresponding type.

public static bool SafeCast(TSource value, out TObject result)

Parameters

value TSource

The enum value to be cast.

result TObject

The cast value.

Returns

bool

true if the value was cast; otherwise, false.

ToString()

Converts the UnmanagedEnumClass<TSource, TObject> instance to a human-readable string representation.

public override string ToString()

Returns

string

A human-readable string representation of the UnmanagedEnumClass<TSource, TObject> instance.

Operators

implicit operator TSource(UnmanagedEnumClass<TSource, TObject>)

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

public static implicit operator TSource(UnmanagedEnumClass<TSource, TObject> value)

Parameters

value UnmanagedEnumClass<TSource, TObject>

The value to convert.

Returns

TSource

implicit operator TObject(UnmanagedEnumClass<TSource, TObject>)

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

public static implicit operator TObject(UnmanagedEnumClass<TSource, TObject> value)

Parameters

value UnmanagedEnumClass<TSource, TObject>

The value to convert.

Returns

TObject

implicit operator UnmanagedEnumClass<TSource, TObject>(TSource)

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

public static implicit operator UnmanagedEnumClass<TSource, TObject>(TSource value)

Parameters

value TSource

The value to convert.

Returns

UnmanagedEnumClass<TSource, TObject>