[]
        
(Showing Draft Content)

GrapeCity.Documents.DX.DataPointer

Struct DataPointer

Namespace
GrapeCity.Documents.DX
Assembly
GcDocs.DX.Windows.dll

Pointer to a native buffer with a specific size.

public struct DataPointer : IEquatable<DataPointer>
Implements
System.IEquatable<T><DataPointer>
Inherited Members
System.ValueType.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()

Constructors

DataPointer(IntPtr, int)

Initializes a new instance of the DataPointer struct.

public DataPointer(IntPtr pointer, int size)

Parameters

pointer System.IntPtr

The pointer.

size int

The size.

DataPointer(void*, int)

Initializes a new instance of the DataPointer struct.

[CLSCompliant(false)]
public DataPointer(void* pointer, int size)

Parameters

pointer void*

The pointer.

size int

The size.

Fields

Pointer

Pointer to the buffer.

public IntPtr Pointer

Field Value

System.IntPtr

Size

Size in bytes of the buffer.

public int Size

Field Value

int

Zero

Gets an Empty Data Pointer.

public static readonly DataPointer Zero

Field Value

DataPointer

Properties

IsEmpty

Gets a value indicating whether this instance is empty (zeroed).

public bool IsEmpty { get; }

Property Value

bool

true if this instance is empty; otherwise, false.

Methods

CopyFrom<T>(T[], int, int)

Writes the content of the specified buffer to the unmanaged memory location of this instance.

public void CopyFrom<T>(T[] buffer, int offset, int count) where T : struct

Parameters

buffer T[]

The buffer to read from.

offset int

The offset in the array to read from.

count int

The number of T element to write to the memory location.

Type Parameters

T

Exceptions

System.ArgumentNullException

buffer

System.InvalidOperationException

DataPointer is Zero

System.ArgumentOutOfRangeException

buffer;Total buffer size cannot be larger than size of this data pointer

CopyFrom<T>(T[])

Writes the content of the specified buffer to the unmanaged memory location of this instance.

public void CopyFrom<T>(T[] buffer) where T : struct

Parameters

buffer T[]

The buffer.

Type Parameters

T

Type of a buffer element

Exceptions

System.ArgumentNullException

buffer

System.InvalidOperationException

DataPointer is Zero

CopyTo<T>(T[], int, int)

Reads the content of the unmanaged memory location of this instance to the specified buffer.

public void CopyTo<T>(T[] buffer, int offset, int count) where T : struct

Parameters

buffer T[]

The buffer.

offset int

The offset in the array to write to.

count int

The number of T element to read from the memory location.

Type Parameters

T

Type of a buffer element

Exceptions

System.ArgumentNullException

buffer

System.InvalidOperationException

DataPointer is Zero

System.ArgumentOutOfRangeException

buffer;Total buffer size cannot be larger than size of this data pointer

Equals(DataPointer)

Determines whether the specified DataPointer is equal to the current object.

public bool Equals(DataPointer other)

Parameters

other DataPointer

Returns

bool

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

ToArray()

Converts this instance to a read only byte buffer.

public byte[] ToArray()

Returns

byte[]

ToArray<T>()

Converts this instance to a read only typed buffer.

public T[] ToArray<T>() where T : struct

Returns

T[]

A readonly typed buffer.

Type Parameters

T

Type of a buffer element

Exceptions

System.InvalidOperationException

DataPointer is Zero

ToDataStream()

Converts this DataPointer to a DataStream.

public DataStream ToDataStream()

Returns

DataStream

An instance of a DataStream.

Operators

operator ==(DataPointer, DataPointer)

Implements the ==.

public static bool operator ==(DataPointer left, DataPointer right)

Parameters

left DataPointer

The left.

right DataPointer

The right.

Returns

bool

The result of the operator.

operator !=(DataPointer, DataPointer)

Implements the !=.

public static bool operator !=(DataPointer left, DataPointer right)

Parameters

left DataPointer

The left.

right DataPointer

The right.

Returns

bool

The result of the operator.