Class MemoryArray<T>
An in-memory array working around the pre .NET core memory limitations for one object.
Inherited Members
Namespace: Mars.Common.IO.Mapped.Arrays
Assembly: Mars.IO.dll
Syntax
public class MemoryArray<T> : ArrayBase<T>, ISerializableToStream, IEnumerable<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
MemoryArray(Int64)
Creates a new array.
Declaration
public MemoryArray(long size)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size |
MemoryArray(Int64, Int32)
Creates a new array.
Declaration
public MemoryArray(long size, int blockSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size | |
System.Int32 | blockSize |
Properties
CanResize
Returns true if this array can be resized.
Declaration
public override bool CanResize { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Mars.Common.IO.Mapped.Arrays.ArrayBase<T>.CanResize
Item[Int64]
Gets or sets the element at the given idx.
Declaration
public override T this[long idx] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | idx |
Property Value
Type | Description |
---|---|
T |
Overrides
Mars.Common.IO.Mapped.Arrays.ArrayBase<T>.Item[System.Int64]
Length
Returns the length of this array.
Declaration
public override long Length { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
Mars.Common.IO.Mapped.Arrays.ArrayBase<T>.Length
Methods
CopyFromWithSize(Stream)
Creates a new memory array reading the size and copying from stream.
Declaration
public static MemoryArray<T> CopyFromWithSize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream. |
Returns
Type | Description |
---|---|
MemoryArray<T> | A memory array. |
Dispose()
Disposes of all associated native resources held by this object.
Declaration
public override void Dispose()
Overrides
Mars.Common.IO.Mapped.Arrays.ArrayBase<T>.Dispose()
Resize(Int64)
Resizes this array.
Declaration
public override void Resize(long size)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size |
Overrides
Mars.Common.IO.Mapped.Arrays.ArrayBase<T>.Resize(System.Int64)
Implements
IEnumerable<>