Show / Hide Table of Contents

Struct Ref<T>

Wrapper for by-ref argument.

Implements
IStrongBox
IEquatable<Ref<T>>
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public struct Ref<T> : IStrongBox, IEquatable<Ref<T>>
Type Parameters
Name Description
T

Referenced type.

Remarks

This type has special semantics when used as argument type for delegates Function<T, A, R>, Function<A, R>, Procedure<T, A>, Procedure<A> when using strongly typed reflection. Argument of this type means that it should be passed into reflected method or constructor by reference. In all other scenarios, including Unreflect<D>(ConstructorInfo) or Unreflect<D>(MethodInfo), this type treated as regular value type without special semantics.

Fields

| Improve this Doc View Source

Value

Gets or sets value.

Declaration
public T Value
Field Value
Type Description
T

Methods

| Improve this Doc View Source

Equals(Object)

Always returns false because two boxed references have different address.

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

Other object to compare.

Returns
Type Description
Boolean

Always false.

Remarks

Use equality operator instead.

| Improve this Doc View Source

GetHashCode()

Gets hash code of this reference based on its address.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

Hash code of the reference.

Operators

| Improve this Doc View Source

Equality(Ref<T>, Ref<T>)

Identifies that two references point to the same location.

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

The first reference.

Ref<T> second

The second reference.

Returns
Type Description
Boolean

True, if both references are equal.

| Improve this Doc View Source

Implicit(T to Ref<T>)

Obtains a reference to the value.

Declaration
public static implicit operator Ref<T>(T value)
Parameters
Type Name Description
T value

A value.

Returns
Type Description
Ref<T>

A reference to a value.

| Improve this Doc View Source

Implicit(Ref<T> to T)

Extracts actual value from the reference.

Declaration
public static implicit operator T(in Ref<T> reference)
Parameters
Type Name Description
Ref<T> reference

Typed reference

Returns
Type Description
T

Dereferenced value.

| Improve this Doc View Source

Inequality(Ref<T>, Ref<T>)

Identifies that two references point to different locations.

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

The first reference.

Ref<T> second

The second reference.

Returns
Type Description
Boolean

True, if both references are not equal.

Implements

IStrongBox
IEquatable<>

Extension Methods

ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX