[This is preliminary documentation and is subject to change.]
Implements storage for a resizable set of resource slots.
| C# |
public struct ResourceSlotSet<T> where T : class
- T
- The type of resource that can be contained in the ResourceSlotSet. This must be a class type.
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| ResourceSlotSet<(Of <(<'T>)>)>(Int32) | Initialises the ResourceSlotSet<(Of <(<'T>)>)> with a particular
initial capacity. | |
| Add(T) | Adds a T resource to the set. | |
| Capacity | Gets the current capacity of the ResourceSlotSet<(Of <(<'T>)>)>. | |
| Count | Gets the number of resources in the set. | |
| Equals(Object) |
Indicates whether this instance and a specified object are equal.
(Inherited from ValueType.) | |
| Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) | |
| GetHashCode()()()() |
Returns the hash code for this instance.
(Inherited from ValueType.) | |
| GetType()()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| Item[([( Int32])]) | Obtains the T resource at a particular slot in the set.
| |
| MemberwiseClone()()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
| Remove(Int32) | Removes a T resource from a particular slot in the set.
| |
| Resources | Gets a collection containing the resources in the set. | |
| SlotOf(T) | Finds the slot containing a particular resource. | |
| ToString()()()() |
Returns the fully qualified type name of this instance.
(Inherited from ValueType.) |
You can add and remove resources from the set. The capacity of the set is increased as necessary, but never decreased. When you add a resource, a slot is returned which is used thereafter to access and remove the resource. When you remove a resource, the slot is reused for subsequent additions.
You must initialise a ResourceSlotSet with the one parameter constructor, otherwise an exception will be thrown when you call any of the methods.
This struct is thread safe.