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.

PrivateObject.GetField Method (String, BindingFlags)


Gets a value from a named field, based on the name and lookup mask.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

public object GetField(
	string name,
	BindingFlags bindingFlags


Type: System.String

The name of the private field to get.


A bitmask comprised of one or more BindingFlags that specifies how the search for the field is conducted. The type of lookup need not be specified. The default value is GetField. If null is used, the default value is passed. Additional flags will be added to the mask.

Return Value

Type: System.Object

The value set for the name field.

Exception Condition

name is null or empty.

Return to top