Partager via


Class.Name Property

Definition

Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object.

public string Name { [Android.Runtime.Register("getName", "()Ljava/lang/String;", "")] get; }
[<get: Android.Runtime.Register("getName", "()Ljava/lang/String;", "")>]
member this.Name : string

Property Value

the name of the class, interface, or other entity represented by this Class object.

Attributes

Remarks

Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object.

If this Class object represents a class or interface, not an array class, then:

If this Class object represents an array class, then the result is a string consisting of one or more '[' characters representing the depth of the array nesting, followed by the element type as encoded using the following table:

<blockquote><table class="striped"> <caption style="display:none">Element types and encodings</caption> <thead> <tr><th scope="col"> Element Type <th scope="col"> Encoding </thead> <tbody style="text-align:left"> <tr><th scope="row"> boolean<td style="text-align:center"> Z<tr><th scope="row"> byte<td style="text-align:center"> B<tr><th scope="row"> char<td style="text-align:center"> C<tr><th scope="row"> class or interface with binary nameN<td style="text-align:center"> L<em>N</em>;<tr><th scope="row"> double<td style="text-align:center"> D<tr><th scope="row"> float<td style="text-align:center"> F<tr><th scope="row"> int<td style="text-align:center"> I<tr><th scope="row"> long<td style="text-align:center"> J<tr><th scope="row"> short<td style="text-align:center"> S</tbody> </table></blockquote>

If this Class object represents a primitive type or void, then the result is a string with the same spelling as the Java language keyword which corresponds to the primitive type or void.

Examples: <blockquote>

String.class.getName()
                returns "java.lang.String"
            byte.class.getName()
                returns "byte"
            (new Object[3]).getClass().getName()
                returns "[Ljava.lang.Object;"
            (new int[3][4][5][6][7][8][9]).getClass().getName()
                returns "[[[[[[[I"

</blockquote>

Java documentation for java.lang.Class.getName().

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.

Applies to