FieldInfo.IsSpecialName-Eigenschaft
Ruft einen Wert ab, der angibt, ob das entsprechende SpecialName-Attribut für den FieldAttributes-Enumerator festgelegt wurde.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public ReadOnly Property IsSpecialName As Boolean
'Usage
Dim instance As FieldInfo
Dim value As Boolean
value = instance.IsSpecialName
public bool IsSpecialName { get; }
public:
virtual property bool IsSpecialName {
bool get () sealed;
}
/** @property */
public final boolean get_IsSpecialName ()
public final function get IsSpecialName () : boolean
Eigenschaftenwert
true, wenn das SpecialName-Attribut in FieldAttributes festgelegt ist, andernfalls false.
Hinweise
Namen, die mit einem Unterstrich (_) beginnen oder einen solchen enthalten, Eigenschaftenaccessoren sowie Operatorüberladungsmethoden stellen Beispiele für Namen dar, die von einigen Compilern möglicherweise besonders behandelt werden müssen.
Beispiel
Im folgenden Beispiel wird ein Wert zurückgegeben, der angibt, ob die Felder der Klasse ein SpecialName-Attribut enthalten.
Imports System
Imports System.Reflection
Imports System.ComponentModel.Design
Imports Microsoft.VisualBasic
Class FieldInfo_IsSpecialName
Public Shared Sub Main()
Try
' Get the type handle of a specified class.
Dim myType As Type = GetType(ViewTechnology)
' Get the fields of a specified class.
Dim myField As FieldInfo() = myType.GetFields()
Console.WriteLine(ControlChars.Cr + "Displaying fields that have SpecialName attributes:" + ControlChars.Cr)
Dim i As Integer
For i = 0 To myField.Length - 1
' Determine whether or not each field is a special name.
If myField(i).IsSpecialName Then
Console.WriteLine("The field {0} has a SpecialName attribute.", myField(i).Name)
End If
Next i
Catch e As Exception
Console.WriteLine("Exception : {0} ", e.Message.ToString())
End Try
End Sub 'Main
End Class 'FieldInfo_IsSpecialName
using System;
using System.Reflection;
using System.ComponentModel.Design;
class FieldInfo_IsSpecialName
{
public static void Main()
{
try
{
// Get the type handle of a specified class.
Type myType = typeof(ViewTechnology);
// Get the fields of the specified class.
FieldInfo[] myField = myType.GetFields();
Console.WriteLine("\nDisplaying fields that have SpecialName attributes:\n");
for(int i = 0; i < myField.Length; i++)
{
// Determine whether or not each field is a special name.
if(myField[i].IsSpecialName)
{
Console.WriteLine("The field {0} has a SpecialName attribute.",
myField[i].Name);
}
}
}
catch(Exception e)
{
Console.WriteLine("Exception : {0} " , e.Message);
}
}
}
#using <system.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::ComponentModel::Design;
int main()
{
try
{
// Get the type handle of a specified class.
Type^ myType = ViewTechnology::typeid;
// Get the fields of the specified class.
array<FieldInfo^>^myField = myType->GetFields();
Console::WriteLine( "\nDisplaying fields that have SpecialName attributes:\n" );
for ( int i = 0; i < myField->Length; i++ )
{
// Determine whether or not each field is a special name.
if ( myField[ i ]->IsSpecialName )
{
Console::WriteLine( "The field {0} has a SpecialName attribute.", myField[ i ]->Name );
}
}
}
catch ( Exception^ e )
{
Console::WriteLine( "Exception : {0} ", e->Message );
}
}
import System.*;
import System.Reflection.*;
import System.ComponentModel.Design.*;
class FieldInfoIsSpecialName
{
public static void main(String[] args)
{
try {
// Get the type handle of a specified class.
Type myType = ViewTechnology.class.ToType();
// Get the fields of the specified class.
FieldInfo myField[] = myType.GetFields();
Console.WriteLine("\nDisplaying fields that have SpecialName"
+ " attributes:\n");
for (int i = 0; i < myField.length; i++) {
// Determine whether or not each field is a special name.
if (myField[i].get_IsSpecialName()) {
Console.WriteLine("The field {0} has a SpecialName"
+ " attribute.", myField[i].get_Name());
}
}
}
catch (System.Exception e) {
Console.WriteLine("Exception : {0} ", e.get_Message());
}
} //main
} //FieldInfoIsSpecialName
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
FieldInfo-Klasse
FieldInfo-Member
System.Reflection-Namespace
FieldAttributes-Enumeration