Class ComWrapper<T>
Wrapper over COM interop for marshalling objects. It is used to give access to COM objects from any thread
Inheritance
object
ComWrapper<T>
Implements
System.IDisposable
Namespace: CAMAPI.DotnetHelper
Assembly: CAMAPI.DotnetHelper.dll
Syntax
public class ComWrapper<T> : Object, IDisposable
Type Parameters
Name | Description |
---|---|
T | Any COM object |
Constructors
ComWrapper(T?)
Create wrapper for COM object
Declaration
public ComWrapper(T? comObject)
Parameters
Type | Name | Description |
---|---|---|
T | comObject | Object that implements COM interface |
ComWrapper(IntPtr)
Create wrapper for COM object
Declaration
public ComWrapper(IntPtr objPointer)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | objPointer | Pointer to COM object |
Properties
Instance
Copy of COM-object, which is accessible from any thread. It is thread-safe, but requires additional resources to store objects for each thread
Declaration
public T? Instance { get; }
Property Value
Type | Description |
---|---|
T |
Methods
Dispose()
Clean up resources
Declaration
public void Dispose()
Invoke(Action<T?>)
Code to executed with current COM-object. Code will be executed in sub thread with MTA apartment state - this will work for all COM-objects, but it should be created also from thread with MTA apartment state
Declaration
public void Invoke(Action<T?> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<><T> | action |
Implements
System.IDisposable