Show / Hide Table of Contents

Class ValueTypeExtensions

Various extensions for value types.

Inheritance
Object
ValueTypeExtensions
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class ValueTypeExtensions : object

Methods

| Improve this Doc View Source

Add(IntPtr, IntPtr)

Adds twp specified native integers.

Declaration
public static IntPtr Add(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first value to add.

IntPtr y

The second value to add.

Returns
Type Description
IntPtr

The result of adding x and y.

| Improve this Doc View Source

Add(UIntPtr, UIntPtr)

Adds twp specified native integers.

Declaration
public static UIntPtr Add(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first value to add.

UIntPtr y

The second value to add.

Returns
Type Description
UIntPtr

The result of adding x and y.

| Improve this Doc View Source

AddChecked(IntPtr, IntPtr)

Adds two specified native integers.

Declaration
public static IntPtr AddChecked(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first value to add.

IntPtr y

The second value to add.

Returns
Type Description
IntPtr

The result of adding x and y.

| Improve this Doc View Source

AddChecked(UIntPtr, UIntPtr)

Adds two specified native integers.

Declaration
public static UIntPtr AddChecked(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first value to add.

UIntPtr y

The second value to add.

Returns
Type Description
UIntPtr

The result of adding x and y.

| Improve this Doc View Source

And(IntPtr, IntPtr)

Computes the bitwise AND of two native integer values.

Declaration
public static IntPtr And(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first operand.

IntPtr y

The second operand.

Returns
Type Description
IntPtr

The bitwise AND.

| Improve this Doc View Source

And(UIntPtr, UIntPtr)

Computes the bitwise AND of two native integer values.

Declaration
public static UIntPtr And(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first operand.

UIntPtr y

The second operand.

Returns
Type Description
UIntPtr

The bitwise AND.

| Improve this Doc View Source

Decrement(IntPtr)

Decrements native integer by 1.

Declaration
public static IntPtr Decrement(this IntPtr value)
Parameters
Type Name Description
IntPtr value

The value to increment.

Returns
Type Description
IntPtr

The decremented value.

| Improve this Doc View Source

Decrement(UIntPtr)

Decrements native integer by 1.

Declaration
public static UIntPtr Decrement(this UIntPtr value)
Parameters
Type Name Description
UIntPtr value

The value to increment.

Returns
Type Description
UIntPtr

The decremented value.

| Improve this Doc View Source

Divide(IntPtr, IntPtr)

Divides two specified native integers.

Declaration
public static IntPtr Divide(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The dividend.

IntPtr y

The divisor.

Returns
Type Description
IntPtr

The result of dividing x by y.

| Improve this Doc View Source

Divide(UIntPtr, UIntPtr)

Divides two specified native integers.

Declaration
public static UIntPtr Divide(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The dividend.

UIntPtr y

The divisor.

Returns
Type Description
UIntPtr

The result of dividing x by y.

| Improve this Doc View Source

EnsureFinite(Double)

Throws if the value is "not a number" (NaN), positive or negative infinity.

Declaration
public static double EnsureFinite(this double value)
Parameters
Type Name Description
Double value

The value to check.

Returns
Type Description
Double

The value that is equal to value.

| Improve this Doc View Source

EnsureFinite(Single)

Throws if the value is "not a number" (NaN), positive or negative infinity.

Declaration
public static float EnsureFinite(this float value)
Parameters
Type Name Description
Single value

The value to check.

Returns
Type Description
Single

The value that is equal to value.

| Improve this Doc View Source

GreaterThan(IntPtr, IntPtr)

Determines whether the native integer is greater than the specified value.

Declaration
public static bool GreaterThan(this IntPtr value, IntPtr comparand)
Parameters
Type Name Description
IntPtr value

The value to compare with other value.

IntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is greater than comparand.

| Improve this Doc View Source

GreaterThan(UIntPtr, UIntPtr)

Determines whether the native integer is greater than the specified value.

Declaration
public static bool GreaterThan(this UIntPtr value, UIntPtr comparand)
Parameters
Type Name Description
UIntPtr value

The value to compare with other value.

UIntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is greater than comparand.

| Improve this Doc View Source

GreaterThanOrEqual(IntPtr, IntPtr)

Determines whether the native integer is greater than or equal to specified value.

Declaration
public static bool GreaterThanOrEqual(this IntPtr value, IntPtr comparand)
Parameters
Type Name Description
IntPtr value

The value to compare with other value.

IntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is greater than or equal to comparand.

| Improve this Doc View Source

GreaterThanOrEqual(UIntPtr, UIntPtr)

Determines whether the native integer is greater than or equal to specified value.

Declaration
public static bool GreaterThanOrEqual(this UIntPtr value, UIntPtr comparand)
Parameters
Type Name Description
UIntPtr value

The value to compare with other value.

UIntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is greater than or equal to comparand.

| Improve this Doc View Source

Increment(IntPtr)

Increments native integer by 1.

Declaration
public static IntPtr Increment(this IntPtr value)
Parameters
Type Name Description
IntPtr value

The value to increment.

Returns
Type Description
IntPtr

The incremented value.

| Improve this Doc View Source

Increment(UIntPtr)

Increments native integer by 1.

Declaration
public static UIntPtr Increment(this UIntPtr value)
Parameters
Type Name Description
UIntPtr value

The value to increment.

Returns
Type Description
UIntPtr

The incremented value.

| Improve this Doc View Source

IsOneOf<T>(T, T[])

Checks whether the specified value is equal to one of the specified values.

Declaration
public static bool IsOneOf<T>(this T value, params T[] values)

    where T : struct, IEquatable<T>
Parameters
Type Name Description
T value

The value to compare with other.

T[] values

Candidate objects.

Returns
Type Description
Boolean

true, if value is equal to one of values.

Type Parameters
Name Description
T

The type of object to compare.

Remarks

This method uses to check equality between two values.

| Improve this Doc View Source

IsOneOf<T>(T, IEnumerable<T>)

Checks whether the specified value is equal to one of the specified values.

Declaration
public static bool IsOneOf<T>(this T value, IEnumerable<T> values)

    where T : struct, IEquatable<T>
Parameters
Type Name Description
T value

The value to compare with other.

IEnumerable<T> values

Candidate objects.

Returns
Type Description
Boolean

true, if value is equal to one of values.

Type Parameters
Name Description
T

The type of object to compare.

Remarks

This method uses to check equality between two values.

| Improve this Doc View Source

LessThan(IntPtr, IntPtr)

Determines whether the native integer is less than the specified value.

Declaration
public static bool LessThan(this IntPtr value, IntPtr comparand)
Parameters
Type Name Description
IntPtr value

The value to compare with other value.

IntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is less than comparand.

| Improve this Doc View Source

LessThan(UIntPtr, UIntPtr)

Determines whether the native integer is less than the specified value.

Declaration
public static bool LessThan(this UIntPtr value, UIntPtr comparand)
Parameters
Type Name Description
UIntPtr value

The value to compare with other value.

UIntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is less than comparand.

| Improve this Doc View Source

LessThanOrEqual(IntPtr, IntPtr)

Determines whether the native integer is less than or equal to specified value.

Declaration
public static bool LessThanOrEqual(this IntPtr value, IntPtr comparand)
Parameters
Type Name Description
IntPtr value

The value to compare with other value.

IntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is less than or equal to comparand.

| Improve this Doc View Source

LessThanOrEqual(UIntPtr, UIntPtr)

Determines whether the native integer is less than or equal to specified value.

Declaration
public static bool LessThanOrEqual(this UIntPtr value, UIntPtr comparand)
Parameters
Type Name Description
UIntPtr value

The value to compare with other value.

UIntPtr comparand

he value that is compared by value to value.

Returns
Type Description
Boolean

true if value is less than or equal to comparand.

| Improve this Doc View Source

Multiply(IntPtr, IntPtr)

Multiplies two specified native integers.

Declaration
public static IntPtr Multiply(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first value to multiply.

IntPtr y

The second value to mulitply.

Returns
Type Description
IntPtr

The result of multiplying x by y.

| Improve this Doc View Source

Multiply(UIntPtr, UIntPtr)

Multiplies two specified native integers.

Declaration
public static UIntPtr Multiply(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first value to multiply.

UIntPtr y

The second value to mulitply.

Returns
Type Description
UIntPtr

The result of multiplying x by y.

| Improve this Doc View Source

MultiplyChecked(IntPtr, IntPtr)

Multiplies two specified native integers.

Declaration
public static IntPtr MultiplyChecked(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first value to multiply.

IntPtr y

The second value to mulitply.

Returns
Type Description
IntPtr

The result of multiplying x by y.

| Improve this Doc View Source

MultiplyChecked(UIntPtr, UIntPtr)

Multiplies two specified native integers.

Declaration
public static UIntPtr MultiplyChecked(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first value to multiply.

UIntPtr y

The second value to mulitply.

Returns
Type Description
UIntPtr

The result of multiplying x by y.

| Improve this Doc View Source

Negate(IntPtr)

Negates native integer value.

Declaration
public static IntPtr Negate(this IntPtr value)
Parameters
Type Name Description
IntPtr value

The value to negate.

Returns
Type Description
IntPtr

The negated value.

| Improve this Doc View Source

OnesComplement(IntPtr)

Computes the bitwise complement of native integer value.

Declaration
public static IntPtr OnesComplement(this IntPtr value)
Parameters
Type Name Description
IntPtr value

The operand.

Returns
Type Description
IntPtr

The result of bitwise complement.

| Improve this Doc View Source

OnesComplement(UIntPtr)

Computes the bitwise complement of native integer value.

Declaration
public static UIntPtr OnesComplement(this UIntPtr value)
Parameters
Type Name Description
UIntPtr value

The operand.

Returns
Type Description
UIntPtr

The result of bitwise complement.

| Improve this Doc View Source

Or(IntPtr, IntPtr)

Computes the bitwise OR of two native integer values.

Declaration
public static IntPtr Or(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first operand.

IntPtr y

The second operand.

Returns
Type Description
IntPtr

The bitwise OR.

| Improve this Doc View Source

Or(UIntPtr, UIntPtr)

Computes the bitwise OR of two native integer values.

Declaration
public static UIntPtr Or(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first operand.

UIntPtr y

The second operand.

Returns
Type Description
UIntPtr

The bitwise OR.

| Improve this Doc View Source

Subtract(IntPtr, IntPtr)

Subtracts two native integers.

Declaration
public static IntPtr Subtract(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The minuend.

IntPtr y

The subtrahend.

Returns
Type Description
IntPtr

The result of subtracting y from x.

| Improve this Doc View Source

Subtract(UIntPtr, UIntPtr)

Subtracts two native integers.

Declaration
public static UIntPtr Subtract(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The minuend.

UIntPtr y

The subtrahend.

Returns
Type Description
UIntPtr

The result of subtracting y from x.

| Improve this Doc View Source

SubtractChecked(IntPtr, IntPtr)

Subtracts two native integers.

Declaration
public static IntPtr SubtractChecked(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The minuend.

IntPtr y

The subtrahend.

Returns
Type Description
IntPtr

The result of subtracting y from x.

| Improve this Doc View Source

SubtractChecked(UIntPtr, UIntPtr)

Subtracts two native integers.

Declaration
public static UIntPtr SubtractChecked(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The minuend.

UIntPtr y

The subtrahend.

Returns
Type Description
UIntPtr

The result of subtracting y from x.

| Improve this Doc View Source

ToBoolean(Int32)

Converts into .

Declaration
public static bool ToBoolean(this int value)
Parameters
Type Name Description
Int32 value

The value to convert.

Returns
Type Description
Boolean

true if value != 0; otherwise, false.

| Improve this Doc View Source

ToInt32(Boolean)

Converts into .

Declaration
public static int ToInt32(this bool value)
Parameters
Type Name Description
Boolean value

The value to convert.

Returns
Type Description
Int32

representation of value.

| Improve this Doc View Source

ToIntPtr(UIntPtr)

Converts into .

Declaration
public static IntPtr ToIntPtr(this UIntPtr value)
Parameters
Type Name Description
UIntPtr value

The value to convert.

Returns
Type Description
IntPtr

The converted value.

| Improve this Doc View Source

ToUIntPtr(IntPtr)

Converts into .

Declaration
public static UIntPtr ToUIntPtr(this IntPtr value)
Parameters
Type Name Description
IntPtr value

The value to convert.

Returns
Type Description
UIntPtr

The converted value.

| Improve this Doc View Source

TryGet<T>(Nullable<T>, out T)

Attempts to get value from nullable container.

Declaration
public static bool TryGet<T>(this in T? nullable, out T value)

    where T : struct
Parameters
Type Name Description
Nullable<T> nullable

Nullable value.

T value

Underlying value.

Returns
Type Description
Boolean

true if nullable is not null; otherwise, false.

Type Parameters
Name Description
T

The underlying value type of the nullable type.

| Improve this Doc View Source

Xor(IntPtr, IntPtr)

Computes the bitwise XOR of two native integer values.

Declaration
public static IntPtr Xor(this IntPtr x, IntPtr y)
Parameters
Type Name Description
IntPtr x

The first operand.

IntPtr y

The second operand.

Returns
Type Description
IntPtr

The bitwise XOR.

| Improve this Doc View Source

Xor(UIntPtr, UIntPtr)

Computes the bitwise XOR of two native integer values.

Declaration
public static UIntPtr Xor(this UIntPtr x, UIntPtr y)
Parameters
Type Name Description
UIntPtr x

The first operand.

UIntPtr y

The second operand.

Returns
Type Description
UIntPtr

The bitwise XOR.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX