Class HostWrapper<T>
Class defines a generic class wrapper. T is the class that is to be wrapped.
Inheritance
Implements
Namespace: Cireson.Core.Common.Helpers
Assembly: Cireson.Core.Common.dll
Syntax
public class HostWrapper<T> : object, IHostWrapper<T> where T : class
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Remarks
Admin, 8/24/2017.
Properties
View SourceHostObject
Gets/Sets the host object.
Declaration
public dynamic HostObject { get; }
Property Value
Type | Description |
---|---|
System.Object | The host object. |
WrappedObj
Gets or sets/Sets the 3rd party object that is being wrapped by this class.
Declaration
protected object WrappedObj { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The wrapped object. |
Methods
View SourceCallPublicMethod(String, Object[])
Calls a public method on the on the host type.
Declaration
public static T CallPublicMethod(string method, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | method | The name of the method to be called. |
System.Object[] | args | Arguments to be passed to the method. |
Returns
Type | Description |
---|---|
T | Returns the T object returned by the specified method. |
Remarks
Admin, 8/24/2017.
CallStaticMethod(String, Object[])
Calls a static method on the on the host type.
Declaration
public static T CallStaticMethod(string method, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | method | The name of the method to be called. |
System.Object[] | args | Arguments to be passed to the method. |
Returns
Type | Description |
---|---|
T | Returns the T object returned by the specified method. |
Remarks
Admin, 8/24/2017.
HostType()
Fetches the host type.
Declaration
public static Type HostType()
Returns
Type | Description |
---|---|
Type | Returns the host type. |
Remarks
Admin, 8/24/2017.
IsHostType(Object)
Determines if the given object is the same type as the 3rd party host object.
Declaration
public bool IsHostType(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object whose type is to be checked. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the object is the same type as the HostObject, else false. |
Remarks
Admin, 8/24/2017.
NewHostObject()
Constructs a new HostObject and assigns it to WrappedMsgObj.
Declaration
public T NewHostObject()
Returns
Type | Description |
---|---|
T | A T. |
Remarks
Using the CreateInstance method instead of new so we do not have to use the new() constraint.
NewHostObject(Object[])
Constructs a new HostObject and assigns it to WrappedMsgObj.
Declaration
public T NewHostObject(object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | args | Arguments to be passed tot he constructor. |
Returns
Type | Description |
---|---|
T | A T. |
Remarks
Admin, 8/24/2017.
WrapHost(Object)
Wraps a 3rd party object.
Declaration
public void WrapHost(object hostObject)
Parameters
Type | Name | Description |
---|---|---|
System.Object | hostObject | The host object to be assigned. |
Remarks
Admin, 8/24/2017.