Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TypedReference.MakeTypedReference Method

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

This API is not CLS-compliant. 

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<CLSCompliantAttribute(False)> _
Public Shared Function MakeTypedReference ( _
	target As Object, _
	flds As FieldInfo() _
) As TypedReference

Parameters

target
Type: System.Object

An object that contains the field described by the first element of flds.

flds
Type: System.Reflection.FieldInfo()

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. The field descriptions must be RuntimeFieldInfo objects supplied by the type system.

Return Value

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

ExceptionCondition
ArgumentNullException

target or flds is Nothing.

-or-

An element of flds is Nothing.

ArgumentException

The flds array has no elements.

-or-

An element of flds is not a RuntimeFieldInfo object.

-or-

The IsInitOnly or IsStatic property of an element of flds is true.

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.

The MakeTypedReference method returns a typed reference to some 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.

NoteNote

Starting with the .NET Framework 2.0 Service Pack 1, this method can be used to access non-public members if the caller has been granted ReflectionPermission with the ReflectionPermissionFlag.RestrictedMemberAccess flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

To use this functionality, your application should target the .NET Framework 3.5 or later.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • SecurityCriticalAttribute 

    Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Show:
© 2015 Microsoft