Table of Contents

Struct IClass

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

This type represents a pointer to an unmanaged open.mp IClass interface.

[OpenMpApi(new Type[] { typeof(IExtensible), typeof(IIDProvider) })]
public readonly struct IClass : IEquatable<IClass>, IClass.IManagedInterface, IExtensible.IManagedInterface, IIDProvider.IManagedInterface, IUnmanagedInterface
Implements
Inherited Members

Constructors

IClass(nint)

Initializes a new instance of the IClass struct.

public IClass(nint handle)

Parameters

handle nint

A pointer to the unmanaged interface.

Properties

Handle

Gets the handle to the unmanaged interface instance.

public nint Handle { get; }

Property Value

nint

HasValue

Gets a value indicating whether the pointer has a value.

public bool HasValue { get; }

Property Value

bool

Methods

AddExtension<T>(T)

Adds the specified managed extension to this extensible.

public void AddExtension<T>(T extension) where T : Extension

Parameters

extension T

An instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.

Type Parameters

T

The type of the managed extension.

Remarks

A managed extension can only be added to one extensible.

Exceptions

ArgumentException

Throw when an instance of the extension type was already added to this extensible.

Equals(IClass)

public bool Equals(IClass other)

Parameters

other IClass

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetClass()

Gets the player class data.

public ref PlayerClass GetClass()

Returns

PlayerClass

A reference to the player class information.

GetExtension(UID)

Gets the extension with the specified id.

public IExtension GetExtension(UID id)

Parameters

id UID

The identifier of the extension type.

Returns

IExtension

The extension or null if the extension could not be found.

GetExtension<T>()

Gets the specified managed extension from this extensible.

public T GetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

GetHashCode()

public override int GetHashCode()

Returns

int

GetID()

Gets the identifier of this unit.

public int GetID()

Returns

int

The identifier of the unit.

QueryExtension<T>()

Gets the specified unmanaged extension from this extensible.

public T QueryExtension<T>() where T : unmanaged, IExtension.IManagedInterface

Returns

T

The unmanaged extension or null if the extension could not be found.

Type Parameters

T

The type of the unmanaged extension.

RemoveExtension(IExtension)

Removes the specified extension from this extensible.

public void RemoveExtension(IExtension extension)

Parameters

extension IExtension

The extension to remove.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension(UID)

Removes the extension with the specified id from this extensible.

public void RemoveExtension(UID id)

Parameters

id UID

The identifier of the extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension<T>(T)

Removes the specified managed extension from this extensible.

public void RemoveExtension<T>(T extension) where T : Extension

Parameters

extension T

The managed extension to remove.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

SetClass(ref PlayerClass)

Sets the player class data.

public void SetClass(ref PlayerClass data)

Parameters

data PlayerClass

The player class data to set.

TryGetExtension<T>()

Tries to get the specified managed extension from this extensible.

public T? TryGetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T or null if no extension with the specified type could be found.

Type Parameters

T

The type of the managed extension.

TryQueryExtension<T>(out T)

Tries to get the specified unmanaged extension from this extensible.

public bool TryQueryExtension<T>(out T extension) where T : unmanaged, IExtension.IManagedInterface

Parameters

extension T

The extension if found, otherwise null.

Returns

bool

true if the extension was found; false otherwise.

Type Parameters

T

The type of the unmanaged extension.

Operators

operator ==(IClass, object?)

Determines whether the specified values are equal.

public static bool operator ==(IClass lhs, object? rhs)

Parameters

lhs IClass

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are equal; otherwise, false.

explicit operator IExtensible(IClass)

Casts the IClass to a IExtensible.

public static explicit operator IExtensible(IClass value)

Parameters

value IClass

The IClass to cast.

Returns

IExtensible

The converted IExtensible.

explicit operator IIDProvider(IClass)

Casts the IClass to a IIDProvider.

public static explicit operator IIDProvider(IClass value)

Parameters

value IClass

The IClass to cast.

Returns

IIDProvider

The converted IIDProvider.

explicit operator IClass(IExtensible)

Casts the IExtensible to a IClass.

public static explicit operator IClass(IExtensible value)

Parameters

value IExtensible

The IExtensible to cast.

Returns

IClass

The converted IClass.

explicit operator IClass(IIDProvider)

Casts the IIDProvider to a IClass.

public static explicit operator IClass(IIDProvider value)

Parameters

value IIDProvider

The IIDProvider to cast.

Returns

IClass

The converted IClass.

operator !=(IClass, object?)

Determines whether the specified values are not equal.

public static bool operator !=(IClass lhs, object? rhs)

Parameters

lhs IClass

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are not equal; otherwise, false.