• Home
  • Tutorials
  • API Documentation
  • Asset Store
Show / Hide Table of Contents
  • SuperNet.Netcode.Compress
    • CompressorDeflate
    • CompressorLZF
    • ICompressor
  • SuperNet.Netcode.Crypto
    • CryptoAES
    • CryptoECDH
    • CryptoRandom
    • CryptoRSA
    • Curve25519
    • ICryptoAuthenticator
    • ICryptoEncryptor
    • ICryptoExchanger
    • ICryptoRandom
  • SuperNet.Netcode.Transport
    • ConnectionRequest
    • DisconnectReason
    • Host
    • HostConfig
    • HostEvents
    • HostStatistics
    • HostTimespan
    • HostTimestamp
    • IHostListener
    • IMessage
    • IMessageListener
    • IPeerListener
    • MessageEvents
    • MessageReceived
    • MessageSent
    • Peer
    • PeerConfig
    • PeerEvents
    • PeerStatistics
  • SuperNet.Netcode.Util
    • Allocator
    • ArrayPool<T>
    • CRC32
    • IPComparer
    • IPResolver
    • IWritable
    • ObjectPool<T>
    • Reader
    • Serializer
    • Writer
  • SuperNet.Unity.Components
    • INetworkAuthoritative
    • INetworkRegisterable
    • INetworkRollbackable
    • NetworkAnimation
    • NetworkAnimator
    • NetworkAuthority
    • NetworkPrefab
    • NetworkRegistrar
    • NetworkSpawner
    • NetworkSyncModeMethod
    • NetworkSyncModeVector2
    • NetworkSyncModeVector3
    • NetworkTransform
  • SuperNet.Unity.Core
    • NetworkComponent
    • NetworkHost
    • NetworkIdentity
    • NetworkIdentityExtensions
    • NetworkManager
  • SuperNet.Unity.Editor
    • NetworkAuthorityEditor
    • NetworkHostEditor
    • NetworkHostEditor.BandwithUnit
    • NetworkIdentityDrawer
    • NetworkManagerEditor
    • NetworkPrefabEditor
    • NetworkSpawnerEditor

Class ArrayPool<T>

Array pool for reusing arrays to avoid too many allocations.

Inheritance
System.Object
ArrayPool<T>
Namespace: SuperNet.Netcode.Util
Assembly: cs.temp.dll.dll
Syntax
public sealed class ArrayPool<T>
Type Parameters
Name Description
T

Underlying array type.

Constructors

ArrayPool(Int32, Int32)

Create a new array pool.

Declaration
public ArrayPool(int count, int maxLength)
Parameters
Type Name Description
System.Int32 count

Number of arrays this pool can hold.

System.Int32 maxLength

Maximum length arrays can be saved at.

Methods

Expand(T[], Int32, Int32, Int32)

Resize an array created by this pool.

Declaration
public T[] Expand(T[] array, int copyLength, int addLength, int expandLength)
Parameters
Type Name Description
T[] array

Array to resize.

System.Int32 copyLength

Number of bytes to copy to the new array.

System.Int32 addLength

Number of bytes to add after the copy length.

System.Int32 expandLength

Array length multiplier.

Returns
Type Description
T[]

A new resized array.

Rent(Int32)

Extract an array from this pool or allocate a new one.

Declaration
public T[] Rent(int minimumLength)
Parameters
Type Name Description
System.Int32 minimumLength

Minimum length that the returned array has to be.

Returns
Type Description
T[]

An unused array.

Return(T[])

Return an array back to this pool.

Declaration
public void Return(T[] array)
Parameters
Type Name Description
T[] array

Array to return.

Back to top Generated by DocFX