Table of Contents

Enum BindingFlags

Namespace
System.Reflection
Assembly
mscorlib.dll

Specifies flags that control binding and the way in which the search for members and types is conducted by reflection.

[Flags]
public enum BindingFlags

Fields

CreateInstance = 512

Specifies that reflection should create an instance of the specified type. Calls the constructor that matches the given arguments. The supplied member name is ignored. If the type of lookup is not specified, (Instance | Public) will apply. It is not possible to call a type initializer. This flag is passed to an InvokeMember method to invoke a constructor.

DeclaredOnly = 2

Specifies that only members declared at the level of the supplied type's hierarchy should be considered. Inherited members are not considered.

Default = 0

Specifies that no binding flags are defined.

ExactBinding = 65536

Specifies that types of the supplied arguments must exactly match the types of the corresponding formal parameters. Reflection throws an exception if the caller supplies a non-null Binder object, since that implies that the caller is supplying BindToXXX implementations that will pick the appropriate method.

FlattenHierarchy = 64

Specifies that public and protected static members up the hierarchy should be returned. Private static members in inherited classes are not returned. Static members include fields, methods, events, and properties. Nested types are not returned.

GetField = 1024

Specifies that the value of the specified field should be returned. This flag is passed to an InvokeMember method to get a field value.

GetProperty = 4096

Specifies that the value of the specified property should be returned. This flag is passed to an InvokeMember method to invoke a property getter.

IgnoreCase = 1

Specifies that the case of the member name should not be considered when binding.

IgnoreReturn = 16777216

Used in COM interop to specify that the return value of the member can be ignored.

Instance = 4

Specifies that instance members are to be included in the search.

InvokeMethod = 256

Specifies that a method is to be invoked. This must not be a constructor or a type initializer. This flag is passed to an InvokeMember method to invoke a method.

NonPublic = 32

Specifies that non-public members are to be included in the search.

OptionalParamBinding = 262144

Returns the set of members whose parameter count matches the number of supplied arguments. This binding flag is used for methods with parameters that have default values and methods with variable arguments (varargs). This flag should only be used with Type.InvokeMember.

Public = 16

Specifies that public members are to be included in the search.

PutDispProperty = 16384

Specifies that the PROPPUT member on a COM object should be invoked. PROPPUT specifies a property-setting function that uses a value. Use PutDispProperty if a property has both PROPPUT and PROPPUTREF and you need to distinguish which one is called.

PutRefDispProperty = 32768

Specifies that the PROPPUTREF member on a COM object should be invoked. PROPPUTREF specifies a property-setting function that uses a reference instead of a value. Use PutRefDispProperty if a property has both PROPPUT and PROPPUTREF and you need to distinguish which one is called.

SetField = 2048

Specifies that the value of the specified field should be set. This flag is passed to an InvokeMember method to set a field value.

SetProperty = 8192

Specifies that the value of the specified property should be set. For COM properties, specifying this binding flag is equivalent to specifying PutDispProperty and PutRefDispProperty. This flag is passed to an InvokeMember method to invoke a property setter.

Static = 8

Specifies that static members are to be included in the search.

SuppressChangeType = 131072

Not implemented.

Remarks

Available only in mscorlib build with support for System.Reflection.