Class DispatchObject
- Namespace
- CsCom.Runtime
- Assembly
- CsCom.Runtime.dll
The base class of the late-bound wrappers generated for dispinterfaces.
public abstract class DispatchObject : IDispatchProvider
- Inheritance
-
DispatchObject
- Implements
- Inherited Members
- Extension Methods
Constructors
DispatchObject(IDispatch)
Initializes a new instance of the DispatchObject class.
protected DispatchObject(IDispatch dispatch)
Parameters
Properties
Dispatch
Gets the wrapped IDispatch interface.
public IDispatch Dispatch { get; }
Property Value
Methods
GetEnumeratorCore()
Gets an enumerator for a collection that exposes a _NewEnum member.
protected ComEnumerator GetEnumeratorCore()
Returns
Invoke(IDispatch, int, DispatchFlags, params ReadOnlySpan<object?>)
Invokes a member of an IDispatch interface.
public static object? Invoke(IDispatch dispatch, int dispId, DispatchFlags flags, params ReadOnlySpan<object?> args)
Parameters
dispatchIDispatchThe interface to invoke the member on.
dispIdintThe dispatch identifier of the member.
flagsDispatchFlagsThe kind of the invocation.
argsReadOnlySpan<object>The arguments, in the declaration order.
Returns
- object
The result of the invocation.
InvokeByRef(IDispatch, int, DispatchFlags, Span<object?>, ReadOnlySpan<bool>)
Invokes a member of an IDispatch interface that has by-reference parameters.
public static object? InvokeByRef(IDispatch dispatch, int dispId, DispatchFlags flags, Span<object?> args, ReadOnlySpan<bool> byRef)
Parameters
dispatchIDispatchThe interface to invoke the member on.
dispIdintThe dispatch identifier of the member.
flagsDispatchFlagsThe kind of the invocation.
argsSpan<object>The arguments, in the declaration order. By-reference arguments are updated in place.
byRefReadOnlySpan<bool>For each argument, whether it is passed by reference.
Returns
- object
The result of the invocation.
InvokeByRef(IDispatch, int, DispatchFlags, Span<object?>, ReadOnlySpan<VarEnum>)
Invokes a member of an IDispatch interface that has by-reference parameters, which are passed as references of the types of the parameters.
public static object? InvokeByRef(IDispatch dispatch, int dispId, DispatchFlags flags, Span<object?> args, ReadOnlySpan<VarEnum> byRef)
Parameters
dispatchIDispatchThe interface to invoke the member on.
dispIdintThe dispatch identifier of the member.
flagsDispatchFlagsThe kind of the invocation.
argsSpan<object>The arguments, in the declaration order. By-reference arguments are updated in place.
byRefReadOnlySpan<VarEnum>For each argument, the type that its reference points to: System.Runtime.InteropServices.VarEnum.VT_EMPTY for an argument passed by value, System.Runtime.InteropServices.VarEnum.VT_VARIANT for a reference to a
VARIANT, otherwise the type of the parameter, e.g. System.Runtime.InteropServices.VarEnum.VT_I4 for along*. An argument that cannot be converted to the type, or whose type has no typed references, is passed as a reference to aVARIANT.
Returns
- object
The result of the invocation.
InvokeGet(int, params ReadOnlySpan<object?>)
Gets the value of a property.
protected object? InvokeGet(int dispId, params ReadOnlySpan<object?> args)
Parameters
dispIdintargsReadOnlySpan<object>
Returns
InvokeMethod(int, params ReadOnlySpan<object?>)
Invokes a method.
protected object? InvokeMethod(int dispId, params ReadOnlySpan<object?> args)
Parameters
dispIdintargsReadOnlySpan<object>
Returns
InvokeMethodByRef(int, Span<object?>, ReadOnlySpan<bool>)
Invokes a method that has by-reference parameters. The values of by-reference arguments are updated in place.
protected object? InvokeMethodByRef(int dispId, Span<object?> args, ReadOnlySpan<bool> byRef)
Parameters
dispIdintThe dispatch identifier of the member.
argsSpan<object>The arguments.
byRefReadOnlySpan<bool>For each argument, whether it is passed by reference.
Returns
InvokeMethodByRef(int, Span<object?>, ReadOnlySpan<VarEnum>)
Invokes a method that has by-reference parameters. The values of by-reference arguments are updated in place.
protected object? InvokeMethodByRef(int dispId, Span<object?> args, ReadOnlySpan<VarEnum> byRef)
Parameters
dispIdintThe dispatch identifier of the member.
argsSpan<object>The arguments.
byRefReadOnlySpan<VarEnum>For each argument, the type that its reference points to: System.Runtime.InteropServices.VarEnum.VT_EMPTY for an argument passed by value, System.Runtime.InteropServices.VarEnum.VT_VARIANT for a reference to a
VARIANT, otherwise the type of the parameter, e.g. System.Runtime.InteropServices.VarEnum.VT_I4 for along*.
Returns
InvokePut(int, object?, params ReadOnlySpan<object?>)
Sets the value of a property.
protected void InvokePut(int dispId, object? value, params ReadOnlySpan<object?> args)
Parameters
dispIdintvalueobjectargsReadOnlySpan<object>
InvokePutRef(int, object?, params ReadOnlySpan<object?>)
Sets the value of a property by reference, or by value if the object has no such setter
(DISP_E_MEMBERNOTFOUND): some descriptions of an object, e.g. an interop assembly, do not tell one from the other.
protected void InvokePutRef(int dispId, object? value, params ReadOnlySpan<object?> args)
Parameters
dispIdintvalueobjectargsReadOnlySpan<object>
ToArray2D<T>(object?)
Converts an invocation result to a zero-based two-dimensional array of T.
protected static T[,]? ToArray2D<T>(object? value)
Parameters
valueobject
Returns
- T[,]
Type Parameters
T
ToArray3D<T>(object?)
Converts an invocation result to a zero-based three-dimensional array of T.
protected static T[,,]? ToArray3D<T>(object? value)
Parameters
valueobject
Returns
- T[,,]
Type Parameters
T
ToArray<T>(object?)
Converts an invocation result to a one-dimensional array of T.
protected static T[]? ToArray<T>(object? value)
Parameters
valueobject
Returns
- T[]
Type Parameters
T
ToInterface<T>(object?)
Converts an invocation result to a COM interface.
protected static T? ToInterface<T>(object? value) where T : class
Parameters
valueobject
Returns
- T
Type Parameters
T
ToWrapper<T>(object?)
Converts an invocation result to a late-bound wrapper.
protected static T? ToWrapper<T>(object? value) where T : class, IDispatchWrapper<T>
Parameters
valueobject
Returns
- T
Type Parameters
T