System.TypedReference Structure

public struct TypedReference

Base Types

Object
  ValueType
    TypedReference

Assembly

mscorlib

Library

Vararg

Summary

Describes an object that contains both a managed pointer to a location and a runtime representation of the type that can be stored at that location.

Description

A TypedReference is a type/value combination used to support variable argument lists (as used by C++, for example), among other things. TypedReference is a built-in value type that can be used for parameters and local variables.

Arrays of TypedReference cannot be created.

A TypedReference cannot be boxed as it contains ByRefs, so it cannot reside on the heap.

See Also

System Namespace

Members

TypedReference Methods

TypedReference.Equals Method
TypedReference.GetHashCode Method
TypedReference.GetTargetType Method
TypedReference.MakeTypedReference Method
TypedReference.SetTypedReference Method
TypedReference.TargetTypeToken Method
TypedReference.ToObject Method


TypedReference.Equals Method

public override bool Equals(object obj)

Summary

Determines whether the current instance and the specified Object represent the same type and value.

Parameters

obj
The Object to compare to the current instance.

Return Value

true if obj represents the same type and value as the current instance; otherwise, false .

Description

[Note: This method overrides System.Object.Equals(System.Object).]

See Also

System.TypedReference Structure, System Namespace

TypedReference.GetHashCode Method

public override int GetHashCode()

Summary

Generates a hash code for the current instance.

Return Value

A Int32 containing the hash code for the current instance.

Description

The algorithm used to generate the hash code is unspecified.

[Note: This method overrides System.Object.GetHashCode.]

See Also

System.TypedReference Structure, System Namespace

TypedReference.GetTargetType Method

public static Type GetTargetType(TypedReference value)

Summary

Returns the type of the target of the specified TypedReference.

Parameters

value
The value whose target's type is to be returned.

Return Value

The Type of the target of the specified TypedReference.

See Also

System.TypedReference Structure, System Namespace

TypedReference.MakeTypedReference Method

public static TypedReference MakeTypedReference(object target, FieldInfo[] flds)

Summary

Makes a TypedReference for a field identified by a specified object and list of field descriptions.

Parameters

target
An object that contains the field described by the first element of flds.
flds
A list of field descriptions where each element describes a field that contains the field described by the succeeding element. Each described field must be a value type.

Return Value

A TypedReference for the field described by the last element of flds.

Exceptions

Exception TypeCondition
ArgumentExceptionThe flds array has no elements.

-or-

An element of flds is not a FieldInfo.

ArgumentNullExceptiontarget or flds is null .

-or-

An element of flds is null .

MissingMemberExceptionParameter target does not contain the field described by the first element of flds, or an element of flds describes a field that is not contained in the field described by the succeeding element of flds.

-or-

The field described by an element of flds is not a value type.

Description

This method returns a TypedReference to the terminal field, where the target parameter contains the field described by the first element of flds, the field described by the first element of flds contains the field described by the second element of flds, and so on, until the terminal field is reached.

See Also

System.TypedReference Structure, System Namespace

TypedReference.SetTypedReference Method

public static void SetTypedReference(TypedReference target, object value)

Summary

Converts the specified value to a TypedReference.

Parameters

target
The target of the conversion.
value
The value to be converted.

Exceptions

Exception TypeCondition
ArgumentNullExceptionvalue is null .

InvalidCastExceptionThe requested conversion is not possible.

Description

This method converts value to target.

See Also

System.TypedReference Structure, System Namespace

TypedReference.TargetTypeToken Method

public static RuntimeTypeHandle TargetTypeToken(TypedReference value)

Summary

Returns the internal metadata type handle for the specified TypedReference.

Parameters

value
The TypedReference for which the type handle is requested.

Return Value

The internal metadata type handle for the specified TypedReference.

See Also

System.TypedReference Structure, System Namespace

TypedReference.ToObject Method

public static object ToObject(TypedReference value)

Summary

Converts the specified TypedReference to a System.Object.

Parameters

value
The TypedReference to be converted.

Return Value

The Object that results from the conversion of the specified TypedReference.

Description

[Note: This might involve a boxing operation.]

See Also

System.TypedReference Structure, System Namespace