Class TypeWrapperBase<TWrapper, TWrapped, TOriginal>
Base class to wrap another type.
Inheritance
System.Object
TypeWrapperBase<TWrapper, TWrapped, TOriginal>
Namespace: MAT.Atlas.Api.Core
Assembly: MAT.Atlas.Api.Core.dll
Syntax
public abstract class TypeWrapperBase<TWrapper, TWrapped, TOriginal> : Object where TWrapper : TypeWrapperBase<TWrapper, TWrapped, TOriginal>, TWrapped, new()
where TOriginal : class
Type Parameters
| Name | Description |
|---|---|
| TWrapper | The wrapper type. |
| TWrapped | The type when wrapped. |
| TOriginal | The original type that is being wrapped. |
Constructors
TypeWrapperBase()
Declaration
protected TypeWrapperBase()
Properties
Instance
The original instance.
Declaration
public TOriginal Instance { get; set; }
Property Value
| Type | Description |
|---|---|
| TOriginal |
Methods
FromWrapper(TWrapped)
Get original instance from wrapped instance.
Declaration
public static TOriginal FromWrapper(TWrapped wrappedInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| TWrapped | wrappedInstance | Instance of wrapped type. |
Returns
| Type | Description |
|---|---|
| TOriginal | The original instance. |
ToWrapper(TOriginal, ref TWrapper)
Create/update wrapper and return wrapped instance from original instance.
Declaration
public static TWrapped ToWrapper(TOriginal instance, ref TWrapper wrapper)
Parameters
| Type | Name | Description |
|---|---|---|
| TOriginal | instance | The original instance. |
| TWrapper | wrapper | The wrapper. |
Returns
| Type | Description |
|---|---|
| TWrapped | Instance of wrapped type. |
Remarks
A new wrapper is returned when original instance reference has changed to ensure standard object identity rules apply.