Show / Hide Table of Contents

Struct Ref<T>

Wrapper for by-ref argument.

Implements
IStrongBox
IEquatable<Ref<T>>
Inherited Members
ValueType.ToString()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
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, TArgs, TResult>, Function<TArgs, TResult>, Procedure<T, TArgs>, Procedure<TArgs> 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<TDelegate>(ConstructorInfo) or Unreflect<TDelegate>(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.

Overrides
ValueType.Equals(Object)
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.

Overrides
ValueType.GetHashCode()

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.

Explicit Interface Implementations

| Improve this Doc View Source

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

Declaration
bool IEquatable<Ref<T>>.Equals(Ref<T> other)
Parameters
Type Name Description
Ref<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.Runtime.CompilerServices.IStrongBox
System.IEquatable<T>

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