Show / Hide Table of Contents

Struct Pointer<T>

CLS-compliant typed pointer for .NET languages without direct support of pointer data type.

Implements
IEquatable<Pointer<T>>
IStrongBox
System.IConvertible<IntPtr>
System.IConvertible<UIntPtr>
IPinnable
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext.Runtime.InteropServices
Assembly: DotNext.Unsafe.dll
Syntax
public struct Pointer<T> : IEquatable<Pointer<T>>, IStrongBox, IConvertible<IntPtr>, IConvertible<UIntPtr>, IPinnable where T : struct
Type Parameters
Name Description
T

The type of pointer.

Remarks

Many methods associated with the pointer are unsafe and can destabilize runtime. Moreover, pointer type doesn't provide automatic memory management. Null-pointer is the only check performed by methods.

Constructors

| Improve this Doc View Source

Pointer(T*)

Constructs CLS-compliant pointer from non CLS-compliant pointer.

Declaration
[CLSCompliant(false)]
public Pointer(T*ptr)
Parameters
Type Name Description
T* ptr

The pointer value.

| Improve this Doc View Source

Pointer(IntPtr)

Constructs pointer from IntPtr value.

Declaration
public Pointer(IntPtr ptr)
Parameters
Type Name Description
IntPtr ptr

The pointer value.

| Improve this Doc View Source

Pointer(UIntPtr)

Constructs pointer from UIntPtr value.

Declaration
[CLSCompliant(false)]
public Pointer(UIntPtr ptr)
Parameters
Type Name Description
UIntPtr ptr

The pointer value.

Properties

| Improve this Doc View Source

Address

Gets pointer address.

Declaration
public IntPtr Address { get; }
Property Value
Type Description
IntPtr
| Improve this Doc View Source

Bytes

Converts this pointer into span of bytes.

Declaration
public Span<byte> Bytes { get; }
Property Value
Type Description
Span<Byte>
| Improve this Doc View Source

IsAligned

Determines whether this pointer is aligned to the size of T.

Declaration
public bool IsAligned { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

IsNull

Indicates that this pointer is null.

Declaration
public bool IsNull { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

Item[Int64]

Gets or sets pointer value at the specified position in the memory.

Declaration
public T this[long index] { get; }
Parameters
Type Name Description
Int64 index

Element index.

Property Value
Type Description
T

Array element.

Remarks

This property doesn't check bounds of the array.

Exceptions
Type Condition
NullPointerException

This array is not allocated.

| Improve this Doc View Source

Null

Represents zero pointer.

Declaration
public static Pointer<T> Null { get; }
Property Value
Type Description
Pointer<T>
| Improve this Doc View Source

Value

Gets the value stored in the memory identified by this pointer.

Declaration
public T Value { get; }
Property Value
Type Description
T

The reference to the memory location.

Exceptions
Type Condition
NullPointerException

The pointer is 0.

Methods

| Improve this Doc View Source

As<TOther>()

Reinterprets pointer type.

Declaration
public Pointer<TOther> As<TOther>()

    where TOther : struct
Returns
Type Description
Pointer<TOther>

Reinterpreted pointer type.

Type Parameters
Name Description
TOther

A new pointer type.

| Improve this Doc View Source

AsStream(Int64, FileAccess)

Returns representation of the memory identified by this pointer in the form of the stream.

Declaration
public Stream AsStream(long count, FileAccess access = FileAccess.Read | FileAccess.ReadWrite | FileAccess.Write)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this memory.

FileAccess access

The type of the access supported by the returned stream.

Returns
Type Description
Stream

The stream representing the memory identified by this pointer.

Remarks

This method returns Stream compatible over the memory identified by this pointer. No copying is performed.

| Improve this Doc View Source

BitwiseCompare(Pointer<T>, Int64)

Bitwise comparison of two memory blocks.

Declaration
public int BitwiseCompare(Pointer<T> other, long count)
Parameters
Type Name Description
Pointer<T> other

The pointer identifies block of memory to be compared.

Int64 count

The number of elements of type T referenced by both pointers.

Returns
Type Description
Int32

Comparison result which has the semantics as return type of CompareTo(Object).

| Improve this Doc View Source

BitwiseEquals(Pointer<T>, Int64)

Computes bitwise equality between two blocks of memory.

Declaration
public bool BitwiseEquals(Pointer<T> other, long count)
Parameters
Type Name Description
Pointer<T> other

The pointer identifies block of memory to be compared.

Int64 count

The number of elements of type T referenced by both pointers.

Returns
Type Description
Boolean

true, if both memory blocks have the same bytes; otherwise, false.

| Improve this Doc View Source

BitwiseHashCode(Int64, Boolean)

Computes 32-bit hash code for the block of memory identified by this pointer.

Declaration
public int BitwiseHashCode(long count, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int32

Content hash code.

| Improve this Doc View Source

BitwiseHashCode(Int64, Int32, Func<Int32, Int32, Int32>, Boolean)

Computes 32-bit hash code for the block of memory identified by this pointer.

Declaration
public int BitwiseHashCode(long count, int hash, Func<int, int, int> hashFunction, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Int32 hash

Initial value of the hash to be passed into hashing function.

Func<Int32, Int32, Int32> hashFunction

The custom hash function.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int32

Content hash code.

| Improve this Doc View Source

BitwiseHashCode(Int64, Int32, ValueFunc<Int32, Int32, Int32>, Boolean)

Computes 32-bit hash code for the block of memory identified by this pointer.

Declaration
public int BitwiseHashCode(long count, int hash, in ValueFunc<int, int, int> hashFunction, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Int32 hash

Initial value of the hash to be passed into hashing function.

ValueFunc<Int32, Int32, Int32> hashFunction

The custom hash function.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int32

Content hash code.

| Improve this Doc View Source

BitwiseHashCode64(Int64, Boolean)

Computes 64-bit hash code for the block of memory identified by this pointer.

Declaration
public long BitwiseHashCode64(long count, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int64

Content hash code.

| Improve this Doc View Source

BitwiseHashCode64(Int64, Int64, Func<Int64, Int64, Int64>, Boolean)

Computes 64-bit hash code for the block of memory identified by this pointer.

Declaration
public long BitwiseHashCode64(long count, long hash, Func<long, long, long> hashFunction, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Int64 hash

Initial value of the hash to be passed into hashing function.

Func<Int64, Int64, Int64> hashFunction

The custom hash function.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int64

Content hash code.

| Improve this Doc View Source

BitwiseHashCode64(Int64, Int64, ValueFunc<Int64, Int64, Int64>, Boolean)

Computes 64-bit hash code for the block of memory identified by this pointer.

Declaration
public long BitwiseHashCode64(long count, long hash, in ValueFunc<long, long, long> hashFunction, bool salted = true)
Parameters
Type Name Description
Int64 count

The number of elements of type T referenced by this pointer.

Int64 hash

Initial value of the hash to be passed into hashing function.

ValueFunc<Int64, Int64, Int64> hashFunction

The custom hash function.

Boolean salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
Int64

Content hash code.

| Improve this Doc View Source

Clear()

Sets value at the address represented by this pointer to the default value of T.

Declaration
public void Clear()
Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

| Improve this Doc View Source

Clear(Int64)

Fill memory with zero bytes.

Declaration
public void Clear(long count)
Parameters
Type Name Description
Int64 count

Number of elements in the unmanaged array.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentOutOfRangeException

count is less than or equal to zero.

| Improve this Doc View Source

Equals(T, IEqualityComparer<T>)

Determines whether the value stored in the memory identified by this pointer is equal to the given value.

Declaration
public bool Equals(T other, IEqualityComparer<T> comparer)
Parameters
Type Name Description
T other

The value to be compared.

IEqualityComparer<T> comparer

The object implementing comparison algorithm.

Returns
Type Description
Boolean

true, if the value stored in the memory identified by this pointer is equal to the given value; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Indicates that this pointer represents the same memory location as other pointer.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
Object other

The object of type Pointer<T> to be compared.

Returns
Type Description
Boolean

true, if this pointer represents the same memory location as other pointer; otherwise, false.

Overrides
ValueType.Equals(Object)
| Improve this Doc View Source

Equals<TOther>(Pointer<TOther>)

Indicates that this pointer represents the same memory location as other pointer.

Declaration
public bool Equals<TOther>(Pointer<TOther> other)

    where TOther : struct
Parameters
Type Name Description
Pointer<TOther> other

The pointer to be compared.

Returns
Type Description
Boolean

true, if this pointer represents the same memory location as other pointer; otherwise, false.

Type Parameters
Name Description
TOther

The type of the another pointer.

| Improve this Doc View Source

Fill(T, Int64)

Fills the elements of the array with a specified value.

Declaration
public void Fill(T value, long count)
Parameters
Type Name Description
T value

The value to assign to each element of the array.

Int64 count

The length of the array.

Exceptions
Type Condition
NullPointerException

This pointer is zero.

ArgumentOutOfRangeException

count is less than zero.

| Improve this Doc View Source

Get()

Gets the value stored in the memory identified by this pointer.

Declaration
public T Get()
Returns
Type Description
T

The value stored in the memory.

Exceptions
Type Condition
NullPointerException

The pointer is 0.

| Improve this Doc View Source

Get(Int64)

Gets the value stored in the memory at the specified position.

Declaration
public T Get(long index)
Parameters
Type Name Description
Int64 index

The index of the element.

Returns
Type Description
T

The value stored in the memory at the specified position.

Exceptions
Type Condition
NullPointerException

The pointer is 0.

| Improve this Doc View Source

GetBoxedPointer()

Gets boxed pointer.

Declaration
[CLSCompliant(false)]
public object GetBoxedPointer()
Returns
Type Description
Object

The boxed pointer.

See Also
Pointer
| Improve this Doc View Source

GetEnumerator(Int64)

Gets enumerator over raw memory.

Declaration
public Pointer<T>.Enumerator GetEnumerator(long length)
Parameters
Type Name Description
Int64 length

A number of elements to iterate.

Returns
Type Description
Pointer.Enumerator<>

Iterator object.

| Improve this Doc View Source

GetHashCode()

Computes hash code of the pointer itself (i.e. address), not of the memory content.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of this pointer.

Overrides
ValueType.GetHashCode()
| Improve this Doc View Source

GetHashCode(IEqualityComparer<T>)

Computes hash code of the value stored in the memory identified by this pointer.

Declaration
public int GetHashCode(IEqualityComparer<T> comparer)
Parameters
Type Name Description
IEqualityComparer<T> comparer

The object implementing custom hash function.

Returns
Type Description
Int32

The hash code of the value stored in the memory identified by this pointer.

| Improve this Doc View Source

ReadFrom(T[], Int64, Int64)

Copies elements from the specified array into the memory block identified by this pointer.

Declaration
public long ReadFrom(T[] source, long offset, long count)
Parameters
Type Name Description
T[] source

The source array.

Int64 offset

The position in the source array from which copying begins.

Int64 count

The number of elements of type T to be copied.

Returns
Type Description
Int64

Actual number of copied elements.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentOutOfRangeException

count or offset is less than zero.

| Improve this Doc View Source

ReadFrom(Stream, Int64)

Copies bytes from the given stream to the memory location identified by this pointer.

Declaration
public long ReadFrom(Stream source, long count)
Parameters
Type Name Description
Stream source

The source stream.

Int64 count

The number of elements of type T to be copied.

Returns
Type Description
Int64

The actual number of copied elements.

Exceptions
Type Condition
NullPointerException

This pointer is zero.

ArgumentException

The stream is not readable.

ArgumentOutOfRangeException

count is less than zero.

| Improve this Doc View Source

ReadFromAsync(Stream, Int64, CancellationToken)

Copies bytes from the given stream to the memory location identified by this pointer asynchronously.

Declaration
public ValueTask<long> ReadFromAsync(Stream source, long count, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Stream source

The source stream.

Int64 count

The number of elements of type T to be copied.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The actual number of copied elements.

Exceptions
Type Condition
NullPointerException

This pointer is zero.

ArgumentException

The stream is not readable.

ArgumentOutOfRangeException

count is less than zero.

OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

Set(T)

Sets the value stored in the memory identified by this pointer.

Declaration
public void Set(T value)
Parameters
Type Name Description
T value

The value to be stored in the memory.

Exceptions
Type Condition
NullPointerException

The pointer is 0.

| Improve this Doc View Source

Set(T, Int64)

Sets the value at the specified position in the memory.

Declaration
public void Set(T value, long index)
Parameters
Type Name Description
T value

The value to be stored in the memory.

Int64 index

The index of the element to modify.

Exceptions
Type Condition
NullPointerException

The pointer is 0.

| Improve this Doc View Source

Swap(Pointer<T>)

Swaps values between this memory location and the given memory location.

Declaration
public void Swap(Pointer<T> other)
Parameters
Type Name Description
Pointer<T> other

The other memory location.

Exceptions
Type Condition
NullPointerException

This pointer is zero.

ArgumentNullException

other pointer is zero.

| Improve this Doc View Source

ToArray(Int64)

Copies the block of memory referenced by this pointer into managed heap as array.

Declaration
public T[] ToArray(long length)
Parameters
Type Name Description
Int64 length

The length of the memory block to be copied.

Returns
Type Description
T[]

The array containing elements from the memory block referenced by this pointer.

| Improve this Doc View Source

ToByteArray(Int64)

Copies the block of memory referenced by this pointer into managed heap as array of bytes.

Declaration
public byte[] ToByteArray(long length)
Parameters
Type Name Description
Int64 length

Number of elements to copy.

Returns
Type Description
Byte[]

A copy of memory block in the form of byte array.

| Improve this Doc View Source

ToMemoryOwner(Int32)

Converts this pointer the memory owner.

Declaration
public IMemoryOwner<T> ToMemoryOwner(int length)
Parameters
Type Name Description
Int32 length

The number of elements in the memory.

Returns
Type Description
IMemoryOwner<T>

The instance of memory owner.

| Improve this Doc View Source

ToSpan(Int32)

Converts this pointer into Span<T>.

Declaration
public Span<T> ToSpan(int length)
Parameters
Type Name Description
Int32 length

The number of elements located in the unmanaged memory identified by this pointer.

Returns
Type Description
Span<T>

Span<T> representing elements in the unmanaged memory.

| Improve this Doc View Source

ToString()

Returns hexadecimal address represented by this pointer.

Declaration
public override string ToString()
Returns
Type Description
String

The hexadecimal value of this pointer.

Overrides
ValueType.ToString()
| Improve this Doc View Source

WriteTo(T[], Int64, Int64)

Copies elements from the memory location identified by this pointer to managed array.

Declaration
public long WriteTo(T[] destination, long offset, long count)
Parameters
Type Name Description
T[] destination

The array to be modified.

Int64 offset

The position in the destination array from which copying begins.

Int64 count

The number of elements of type T to be copied.

Returns
Type Description
Int64

Actual number of copied elements.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentOutOfRangeException

count or offset is less than zero.

| Improve this Doc View Source

WriteTo(Pointer<T>, Int64)

Copies block of memory from the source address to the destination address.

Declaration
public void WriteTo(Pointer<T> destination, long count)
Parameters
Type Name Description
Pointer<T> destination

Destination address.

Int64 count

The number of elements to be copied.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentNullException

Destination pointer is zero.

| Improve this Doc View Source

WriteTo(Stream, Int64)

Copies bytes from the memory location identified by this pointer to the stream.

Declaration
public void WriteTo(Stream destination, long count)
Parameters
Type Name Description
Stream destination

The destination stream.

Int64 count

The number of elements of type T to be copied.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentException

The stream is not writable.

ArgumentOutOfRangeException

count is less than zero.

| Improve this Doc View Source

WriteToAsync(Stream, Int64, CancellationToken)

Copies bytes from the memory location identified by this pointer to the stream asynchronously.

Declaration
public ValueTask WriteToAsync(Stream destination, long count, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Stream destination

The destination stream.

Int64 count

The number of elements of type T to be copied.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task instance representing asynchronous state of the copying process.

Exceptions
Type Condition
NullPointerException

This pointer is equal to zero.

ArgumentOutOfRangeException

count is less than zero.

ArgumentException

The stream is not writable.

OperationCanceledException

The operation has been canceled.

Operators

| Improve this Doc View Source

Addition(Pointer<T>, Int32)

Adds an offset to the value of a pointer.

Declaration
public static Pointer<T> operator +(Pointer<T> pointer, int offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to add the offset to.

Int32 offset

The offset to add.

Returns
Type Description
Pointer<T>

A new pointer that reflects the addition of offset to pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Addition(Pointer<T>, Int64)

Adds an offset to the value of a pointer.

Declaration
public static Pointer<T> operator +(Pointer<T> pointer, long offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to add the offset to.

Int64 offset

The offset to add.

Returns
Type Description
Pointer<T>

A new pointer that reflects the addition of offset to pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Addition(Pointer<T>, IntPtr)

Adds an offset to the value of a pointer.

Declaration
public static Pointer<T> operator +(Pointer<T> pointer, IntPtr offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to add the offset to.

IntPtr offset

The offset to add.

Returns
Type Description
Pointer<T>

A new pointer that reflects the addition of offset to pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Addition(Pointer<T>, UInt64)

Adds an offset to the value of a pointer.

Declaration
[CLSCompliant(false)]
public static Pointer<T> operator +(Pointer<T> pointer, ulong offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to add the offset to.

UInt64 offset

The offset to add.

Returns
Type Description
Pointer<T>

A new pointer that reflects the addition of offset to pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Decrement(Pointer<T>)

Decrements this pointer by 1 element of type T.

Declaration
public static Pointer<T> operator --(Pointer<T> pointer)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to subtract the offset from.

Returns
Type Description
Pointer<T>

A new pointer that reflects the subtraction of offset from pointer.

| Improve this Doc View Source

Equality(Pointer<T>, Pointer<T>)

Indicates that the first pointer represents the same memory location as the second pointer.

Declaration
public static bool operator ==(Pointer<T> first, Pointer<T> second)
Parameters
Type Name Description
Pointer<T> first

The first pointer to be compared.

Pointer<T> second

The second pointer to be compared.

Returns
Type Description
Boolean

true, if the first pointer represents the same memory location as the second pointer; otherwise, false.

| Improve this Doc View Source

Explicit(MemoryHandle to Pointer<T>)

Obtains pointer to the memory represented by given memory handle.

Declaration
public static explicit operator Pointer<T>(in MemoryHandle handle)
Parameters
Type Name Description
MemoryHandle handle

The memory handle.

Returns
Type Description
Pointer<T>
| Improve this Doc View Source

False(Pointer<T>)

Checks whether this pointer is zero.

Declaration
public static bool operator false (Pointer<T> ptr)
Parameters
Type Name Description
Pointer<T> ptr

The pointer to check.

Returns
Type Description
Boolean

true, if this pointer is zero; otherwise, false.

| Improve this Doc View Source

Implicit(T* to Pointer<T>)

Converts non CLS-compliant pointer into its CLS-compliant representation.

Declaration
[CLSCompliant(false)]
public static implicit operator Pointer<T>(T*value)
Parameters
Type Name Description
T* value

The pointer value.

Returns
Type Description
Pointer<T>
| Improve this Doc View Source

Implicit(Pointer<T> to T*)

Converts CLS-compliant pointer into its non CLS-compliant representation.

Declaration
[CLSCompliant(false)]
public static implicit operator T*(Pointer<T> ptr)
Parameters
Type Name Description
Pointer<T> ptr

The pointer value.

Returns
Type Description
T*
| Improve this Doc View Source

Implicit(Pointer<T> to IntPtr)

Obtains pointer value (address) as IntPtr.

Declaration
public static implicit operator IntPtr(Pointer<T> ptr)
Parameters
Type Name Description
Pointer<T> ptr

The pointer to be converted.

Returns
Type Description
IntPtr
| Improve this Doc View Source

Implicit(Pointer<T> to UIntPtr)

Obtains pointer value (address) as UIntPtr.

Declaration
[CLSCompliant(false)]
public static implicit operator UIntPtr(Pointer<T> ptr)
Parameters
Type Name Description
Pointer<T> ptr

The pointer to be converted.

Returns
Type Description
UIntPtr
| Improve this Doc View Source

Increment(Pointer<T>)

Increments this pointer by 1 element of type T.

Declaration
public static Pointer<T> operator ++(Pointer<T> pointer)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to add the offset to.

Returns
Type Description
Pointer<T>

A new pointer that reflects the addition of offset to pointer.

| Improve this Doc View Source

Inequality(Pointer<T>, Pointer<T>)

Indicates that the first pointer represents the different memory location as the second pointer.

Declaration
public static bool operator !=(Pointer<T> first, Pointer<T> second)
Parameters
Type Name Description
Pointer<T> first

The first pointer to be compared.

Pointer<T> second

The second pointer to be compared.

Returns
Type Description
Boolean

true, if the first pointer represents the different memory location as the second pointer; otherwise, false.

| Improve this Doc View Source

Subtraction(Pointer<T>, Int32)

Subtracts an offset from the value of a pointer.

Declaration
public static Pointer<T> operator -(Pointer<T> pointer, int offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to subtract the offset from.

Int32 offset

The offset to subtract.

Returns
Type Description
Pointer<T>

A new pointer that reflects the subtraction of offset from pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Subtraction(Pointer<T>, Int64)

Subtracts an offset from the value of a pointer.

Declaration
public static Pointer<T> operator -(Pointer<T> pointer, long offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to subtract the offset from.

Int64 offset

The offset to subtract.

Returns
Type Description
Pointer<T>

A new pointer that reflects the subtraction of offset from pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Subtraction(Pointer<T>, IntPtr)

Subtracts an offset from the value of a pointer.

Declaration
public static Pointer<T> operator -(Pointer<T> pointer, IntPtr offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to subtract the offset from.

IntPtr offset

The offset to subtract.

Returns
Type Description
Pointer<T>

A new pointer that reflects the subtraction of offset from pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

Subtraction(Pointer<T>, UInt64)

Subtracts an offset from the value of a pointer.

Declaration
[CLSCompliant(false)]
public static Pointer<T> operator -(Pointer<T> pointer, ulong offset)
Parameters
Type Name Description
Pointer<T> pointer

The pointer to subtract the offset from.

UInt64 offset

The offset to subtract.

Returns
Type Description
Pointer<T>

A new pointer that reflects the subtraction of offset from pointer.

Remarks

The offset specifies number of elements of type T, not bytes.

| Improve this Doc View Source

True(Pointer<T>)

Checks whether this pointer is not zero.

Declaration
public static bool operator true (Pointer<T> ptr)
Parameters
Type Name Description
Pointer<T> ptr

The pointer to check.

Returns
Type Description
Boolean

true, if this pointer is not zero; otherwise, false.

Explicit Interface Implementations

| Improve this Doc View Source

IPinnable.Pin(Int32)

Declaration
MemoryHandle IPinnable.Pin(int elementIndex)
Parameters
Type Name Description
Int32 elementIndex
Returns
Type Description
MemoryHandle
| Improve this Doc View Source

IPinnable.Unpin()

Declaration
void IPinnable.Unpin()
| Improve this Doc View Source

IEquatable<Pointer<T>>.Equals(Pointer<T>)

Declaration
bool IEquatable<Pointer<T>>.Equals(Pointer<T> other)
Parameters
Type Name Description
Pointer<T> other
Returns
Type Description
Boolean
| Improve this Doc View Source

IStrongBox.Value

Declaration
object IStrongBox.Value { get; set; }
Returns
Type Description
Object

Implements

System.IEquatable<T>
System.Runtime.CompilerServices.IStrongBox
System.IConvertible<>
System.IConvertible<>
System.Buffers.IPinnable

Extension Methods

ValueTypeExtensions.IsOneOf<T>(T, IEnumerable<T>)
ValueTypeExtensions.IsOneOf<T>(T, T[])
Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX