public struct TypedReference
Object
ValueType
TypedReference
mscorlib
Vararg
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.
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.
System Namespace
TypedReference Methods
TypedReference.Equals Method
TypedReference.GetHashCode Method
TypedReference.GetTargetType Method
TypedReference.MakeTypedReference Method
TypedReference.SetTypedReference Method
TypedReference.TargetTypeToken Method
TypedReference.ToObject Method
public override bool Equals(object obj)
Determines whether the current instance and the specified Object represent the same type and value.
- obj
- The Object to compare to the current instance.
true
if obj represents the same type and value as the current instance; otherwise,false
.
[Note: This method overrides System.Object.Equals(System.Object).]
System.TypedReference Structure, System Namespace
public override int GetHashCode()
Generates a hash code for the current instance.
A Int32 containing the hash code for the current instance.
The algorithm used to generate the hash code is unspecified.[Note: This method overrides System.Object.GetHashCode.]
System.TypedReference Structure, System Namespace
public static Type GetTargetType(TypedReference value)
Returns the type of the target of the specified TypedReference.
- value
- The value whose target's type is to be returned.
The Type of the target of the specified TypedReference.
System.TypedReference Structure, System Namespace
public static TypedReference MakeTypedReference(object target, FieldInfo[] flds)
Makes a TypedReference for a field identified by a specified object and list of field descriptions.
- 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.
A TypedReference for the field described by the last element of flds.
Exception Type Condition ArgumentException The flds array has no elements. -or-
An element of flds is not a FieldInfo.
ArgumentNullException target or flds is null
.-or-
An element of flds is
null
.
MissingMemberException Parameter 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.
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.
System.TypedReference Structure, System Namespace
public static void SetTypedReference(TypedReference target, object value)
Converts the specified value to a TypedReference.
- target
- The target of the conversion.
- value
- The value to be converted.
Exception Type Condition ArgumentNullException value is null
.
InvalidCastException The requested conversion is not possible.
This method converts value to target.
System.TypedReference Structure, System Namespace
public static RuntimeTypeHandle TargetTypeToken(TypedReference value)
Returns the internal metadata type handle for the specified TypedReference.
- value
- The TypedReference for which the type handle is requested.
The internal metadata type handle for the specified TypedReference.
System.TypedReference Structure, System Namespace
public static object ToObject(TypedReference value)
Converts the specified TypedReference to a System.Object.
- value
- The TypedReference to be converted.
The Object that results from the conversion of the specified TypedReference.
[Note: This might involve a boxing operation.]
System.TypedReference Structure, System Namespace