Table of Contents

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

dispatch IDispatch

The wrapped IDispatch interface.

Properties

Dispatch

Gets the wrapped IDispatch interface.

public IDispatch Dispatch { get; }

Property Value

IDispatch

Methods

GetEnumeratorCore()

Gets an enumerator for a collection that exposes a _NewEnum member.

protected ComEnumerator GetEnumeratorCore()

Returns

ComEnumerator

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

dispatch IDispatch

The interface to invoke the member on.

dispId int

The dispatch identifier of the member.

flags DispatchFlags

The kind of the invocation.

args ReadOnlySpan<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

dispatch IDispatch

The interface to invoke the member on.

dispId int

The dispatch identifier of the member.

flags DispatchFlags

The kind of the invocation.

args Span<object>

The arguments, in the declaration order. By-reference arguments are updated in place.

byRef ReadOnlySpan<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

dispatch IDispatch

The interface to invoke the member on.

dispId int

The dispatch identifier of the member.

flags DispatchFlags

The kind of the invocation.

args Span<object>

The arguments, in the declaration order. By-reference arguments are updated in place.

byRef ReadOnlySpan<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 a long*. An argument that cannot be converted to the type, or whose type has no typed references, is passed as a reference to a VARIANT.

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

dispId int
args ReadOnlySpan<object>

Returns

object

InvokeMethod(int, params ReadOnlySpan<object?>)

Invokes a method.

protected object? InvokeMethod(int dispId, params ReadOnlySpan<object?> args)

Parameters

dispId int
args ReadOnlySpan<object>

Returns

object

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

dispId int

The dispatch identifier of the member.

args Span<object>

The arguments.

byRef ReadOnlySpan<bool>

For each argument, whether it is passed by reference.

Returns

object

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

dispId int

The dispatch identifier of the member.

args Span<object>

The arguments.

byRef ReadOnlySpan<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 a long*.

Returns

object

InvokePut(int, object?, params ReadOnlySpan<object?>)

Sets the value of a property.

protected void InvokePut(int dispId, object? value, params ReadOnlySpan<object?> args)

Parameters

dispId int
value object
args ReadOnlySpan<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

dispId int
value object
args ReadOnlySpan<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

value object

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

value object

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

value object

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

value object

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

value object

Returns

T

Type Parameters

T