BindingFlags Enumeration
Contains flags that control binding and the way in which the search for members and types is conducted by reflection.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
[FlagsAttribute]
[SerializableAttribute]
public enum BindingFlags
Members
Member name | Description | |
---|---|---|
CreateInstance | A binding flag specifying that reflection should create an instance of the specified type. Reflection calls the constructor that matches the given arguments. The provided 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. | |
DeclaredOnly | A binding flag specifying that only members declared at the level of the supplied type's hierarchy should be considered. Inherited members are not considered. | |
Default | A value indicating that there is no binding flag. | |
ExactBinding | A binding flag specifying that types of the provided arguments must exactly match the types of the corresponding formal parameters. Reflection throws an exception if the caller supplies a non-null Binder object, because that implies that the caller is providing BindToX implementations (where X represents the name of a method that begins with BindTo) that will select the appropriate method. Reflection models the accessibility rules of the common type system. For example, if the caller is in the same assembly, the caller does not need special permissions for internal members. Otherwise, the caller needs ReflectionPermission. This is consistent with the rules for looking up members that are protected, private, and so on. The general principle is that the ChangeType method should perform only widening coercions, which never lose data. An example of a widening coercion is the coercion of a value that is a 32-bit signed integer to a value that is a 64-bit signed integer. This is distinguished from a narrowing coercion, which may lose data. An example of a narrowing coercion is the coercion of a 64-bit signed integer to a 32-bit signed integer. The default binder ignores this flag, whereas custom binders can implement the semantics of this flag. |
|
FlattenHierarchy | A binding flag specifying that static members that are farther up the hierarchy should be returned. Static members include fields, methods, events, and properties. Nested types are not returned. | |
GetField | A binding flag specifying that the value of the specified field should be returned. | |
GetProperty | A binding flag specifying that the value of the specified property should be returned. | |
IgnoreCase | A binding flag specifying that the case of the member name should not be considered when binding. | |
IgnoreReturn | A binding flag used in COM interop to specify that the return value of the member can be ignored. | |
Instance | A binding flag specifying that instance members are to be included in the search. | |
InvokeMethod | A binding flag specifying that a method is to be invoked. This cannot be a constructor or a type initializer. | |
NonPublic | A binding flag specifying that nonpublic members are to be included in the search. | |
OptionalParamBinding | A binding flag that returns the set of members whose parameter count matches the number of provided arguments. This flag is used for methods with parameters that have default values and for methods with variable arguments (varargs). Note that this flag should be passed only to the Type.InvokeMember method. Parameters with default values are used only in calls in which trailing arguments are omitted. Those parameters must be the last arguments. |
|
Public | A binding flag specifying 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 specify which one is to be called. | |
PutDispProperty | A binding flag specifying 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 specify which one is to be called. | |
PutRefDispProperty | A binding flag specifying 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 specify which one is to be called. | |
SetField | A binding flag specifying that the value of the specified field should be set. | |
SetProperty | A binding flag specifying that the value of the specified property should be set. For COM properties, specifying this binding flag is equivalent to specifying PutDispProperty and PutRefDispProperty. | |
Static | A binding flag specifying that static members are to be included in the search. | |
SuppressChangeType | Not currently implemented. |
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.