Struct IExtensible
This type represents a pointer to an unmanaged open.mp IExtensible interface.
[OpenMpApi(new Type[] { })]
public readonly struct IExtensible : IEquatable<IExtensible>, IExtensible.IManagedInterface, IUnmanagedInterface
- Implements
- Inherited Members
Constructors
IExtensible(nint)
Initializes a new instance of the IExtensible struct.
public IExtensible(nint handle)
Parameters
handlenintA pointer to the unmanaged interface.
Properties
Handle
Gets the handle to the unmanaged interface instance.
public nint Handle { get; }
Property Value
HasValue
Gets a value indicating whether the pointer has a value.
public bool HasValue { get; }
Property Value
Methods
AddExtension<T>(T)
Adds the specified managed extension to this extensible.
public void AddExtension<T>(T extension) where T : Extension
Parameters
extensionTAn instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.
Type Parameters
TThe 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(IExtensible)
public bool Equals(IExtensible other)
Parameters
otherIExtensible
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
GetExtension(UID)
Gets the extension with the specified id.
[OpenMpApiOverload("_workaround")]
public IExtension GetExtension(UID id)
Parameters
idUIDThe 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
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
GetHashCode()
public override int GetHashCode()
Returns
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
TThe type of the unmanaged extension.
RemoveExtension(IExtension)
Removes the specified extension from this extensible.
public void RemoveExtension(IExtension extension)
Parameters
extensionIExtensionThe 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
idUIDThe 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
extensionTThe managed extension to remove.
Type Parameters
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
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
Tor null if no extension with the specified type could be found.
Type Parameters
TThe 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
extensionTThe extension if found, otherwise null.
Returns
Type Parameters
TThe type of the unmanaged extension.
Operators
operator ==(IExtensible, object?)
Determines whether the specified values are equal.
public static bool operator ==(IExtensible lhs, object? rhs)
Parameters
lhsIExtensibleThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are equal; otherwise,false.
operator !=(IExtensible, object?)
Determines whether the specified values are not equal.
public static bool operator !=(IExtensible lhs, object? rhs)
Parameters
lhsIExtensibleThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are not equal; otherwise,false.