Class ContextContainer
ContextContainer is a Dictionary like storage where the key is a generic parameter and the value is of the same type.
Implements
Inherited Members
Namespace: UnityEngine .Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public class ContextContainer : IDisposable
Methods
Contains<T>()
Check if the value of type T has previously been created.
Declaration
public bool Contains<T>() where T : ContextItem, new()
Returns
Type | Description |
---|---|
bool | Returns true if the value exists and false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Is the class which you are trying to fetch. T has to inherit from |
Create<T>()
Creates the value of type T.
Declaration
public T Create<T>() where T : ContextItem, new()
Returns
Type | Description |
---|---|
T | The value of type T created inside the |
Type Parameters
Name | Description |
---|---|
T | Is the class which you are trying to fetch. T has to inherit from |
Exceptions
Type | Condition |
---|---|
Invalid |
Thown if you try to create the value of type T agian after it is already created. |
Dispose()
Call Dispose to remove the created values.
Declaration
public void Dispose()
GetOrCreate<T>()
Creates the value of type T if the value is not previously created otherwise try to get the value of type T.
Declaration
public T GetOrCreate<T>() where T : ContextItem, new()
Returns
Type | Description |
---|---|
T | Returns the value of type T which is created or retrived. |
Type Parameters
Name | Description |
---|---|
T | Is the class which you are trying to fetch. T has to inherit from |
Get<T>()
Retrives a T of class ContextContainerItem
if it was previously created without it being disposed.
Declaration
public T Get<T>() where T : ContextItem, new()
Returns
Type | Description |
---|---|
T | The value created previously using Create<T> . |
Type Parameters
Name | Description |
---|---|
T | Is the class which you are trying to fetch. T has to inherit from |
Exceptions
Type | Condition |
---|---|
Invalid |
This is thown if the value isn't previously created. |