Class Shared
Shared resource utility.
Inheritance
System.Object
Shared
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public static class Shared : object
Methods
View SourceCreate<T>(T)
Creates a Shared<T> instance wrapping the specified resource. The returned instance must be disposed.
Declaration
public static Shared<T> Create<T>(T resource)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | resource | The resource to wrap. Usually a large memory allocation. |
Returns
Type Parameters
Name | Description |
---|---|
T | The type of resource being wrapped. |
Remarks
The reference count of the resource is incremented before this method returns. When the returned Shared<T> is disposed, resource's reference count is decremented. When the reference count reaches 0, the wrapped resource is released and disposed.