133 lines
3.4 KiB
Markdown
133 lines
3.4 KiB
Markdown
# <a id="CapyKit_PoolItem_1"></a> Class PoolItem<T\>
|
|
|
|
Namespace: [CapyKit](CapyKit.md)
|
|
Assembly: CapyKit.dll
|
|
|
|
A pool item. This class cannot be inherited.
|
|
|
|
```csharp
|
|
public sealed class PoolItem<T>
|
|
```
|
|
|
|
#### Type Parameters
|
|
|
|
`T`
|
|
|
|
The type of the pooled item.
|
|
|
|
#### Inheritance
|
|
|
|
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
|
|
[PoolItem<T\>](CapyKit.PoolItem\-1.md)
|
|
|
|
#### Inherited Members
|
|
|
|
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
|
|
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
|
|
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
|
|
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
|
|
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
|
|
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
|
|
|
|
#### Extension Methods
|
|
|
|
[ObjectExtensions.UpdateProperties<PoolItem<T\>\>\(PoolItem<T\>, PoolItem<T\>\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_\_1\_\_\_0\_\_\_0\_),
|
|
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
|
|
|
|
## Properties
|
|
|
|
### <a id="CapyKit_PoolItem_1_Index"></a> Index
|
|
|
|
Gets the zero-based index of the pooled item.
|
|
|
|
```csharp
|
|
public int Index { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[int](https://learn.microsoft.com/dotnet/api/system.int32)
|
|
|
|
### <a id="CapyKit_PoolItem_1_Item"></a> Item
|
|
|
|
Gets the pooled resource.
|
|
|
|
```csharp
|
|
public T Item { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
T
|
|
|
|
### <a id="CapyKit_PoolItem_1_Locked"></a> Locked
|
|
|
|
Gets a value indicating whether this object is locked or not.
|
|
|
|
```csharp
|
|
public bool Locked { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
|
|
|
|
### <a id="CapyKit_PoolItem_1_TypeName"></a> TypeName
|
|
|
|
Gets the name of the <xref href="System.Type" data-throw-if-not-resolved="false"></xref> of the pooled item.
|
|
|
|
```csharp
|
|
public string TypeName { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
## Methods
|
|
|
|
### <a id="CapyKit_PoolItem_1_ReleaseLock"></a> ReleaseLock\(\)
|
|
|
|
Releases the lock on the item.
|
|
|
|
```csharp
|
|
public void ReleaseLock()
|
|
```
|
|
|
|
#### Remarks
|
|
|
|
If the item is not locked, an error event is emitted.
|
|
|
|
### <a id="CapyKit_PoolItem_1_SetLock"></a> SetLock\(\)
|
|
|
|
Sets the lock on the item indicating that it is in use.
|
|
|
|
```csharp
|
|
public bool SetLock()
|
|
```
|
|
|
|
#### Returns
|
|
|
|
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
|
|
|
|
<a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if the item is locked successfully, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if it
|
|
fails.
|
|
|
|
#### Remarks
|
|
|
|
If the item is already locked, an error event is emitted.
|
|
|
|
### <a id="CapyKit_PoolItem_1_ToString"></a> ToString\(\)
|
|
|
|
Returns a string that represents the current object and its lock state.
|
|
|
|
```csharp
|
|
public override string ToString()
|
|
```
|
|
|
|
#### Returns
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
A string that represents the current object and its lock state.
|
|
|