Class.GetField(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a Field
object that reflects the specified public member
field of the class or interface represented by this Class
object.
[Android.Runtime.Register("getField", "(Ljava/lang/String;)Ljava/lang/reflect/Field;", "")]
public Java.Lang.Reflect.Field GetField (string name);
[<Android.Runtime.Register("getField", "(Ljava/lang/String;)Ljava/lang/reflect/Field;", "")>]
member this.GetField : string -> Java.Lang.Reflect.Field
Parameters
- name
- String
the field name
Returns
the Field
object of this class specified by
name
- Attributes
Exceptions
if the field cannot be found.
Remarks
Returns a Field
object that reflects the specified public member field of the class or interface represented by this Class
object. The name
parameter is a String
specifying the simple name of the desired field.
The field to be reflected is determined by the algorithm that follows. Let C be the class or interface represented by this object:
<OL> <LI> If C declares a public field with the name specified, that is the field to be reflected.</LI> <LI> If no field was found in step 1 above, this algorithm is applied recursively to each direct superinterface of C. The direct superinterfaces are searched in the order they were declared.</LI> <LI> If no field was found in steps 1 and 2 above, and C has a superclass S, then this algorithm is invoked recursively upon S. If C has no superclass, then a NoSuchFieldException
is thrown.</LI> </OL>
If this Class
object represents an array type, then this method does not find the length
field of the array type.
Added in 1.1.
Java documentation for java.lang.Class.getField(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.