Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

FieldInfo.SetValueDirect Method

Sets the value of the field supported by the given object.

This method is not CLS-compliant.   The CLS-compliant alternative is SetValue(Object,Object,BindingFlags,Binder,CultureInfo).

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

[CLSCompliantAttribute(false)] 
public virtual void SetValueDirect (
	TypedReference obj,
	Object value
)
/** @attribute CLSCompliantAttribute(false) */ 
public void SetValueDirect (
	TypedReference obj, 
	Object value
)
CLSCompliantAttribute(false) 
public function SetValueDirect (
	obj : TypedReference, 
	value : Object
)
Not applicable.

Parameters

obj

A TypedReference structure that encapsulates a managed pointer to a location and a runtime representation of the type that can be stored at that location.

value

The value to assign to the field.

Exception typeCondition

NotSupportedException

The caller requires the Common Language Specification (CLS) alternative, but called this method instead.

NoteNote:

Starting with the , this method can be used to access non-public members if the caller has been granted ReflectionPermission with the ReflectionPermissionFlag.ReflectionEmit 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 . For more information, see The .NET Framework 3.5 Architecture.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.