FieldInfo::IsSpecialName Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets a value indicating whether the corresponding SpecialName attribute is set in the FieldAttributes enumerator.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

property bool IsSpecialName {
	virtual bool get() sealed;

Property Value

Type: System::Boolean

true if the SpecialName attribute is set in FieldAttributes; otherwise, false.

Names that begin with or contain an underscore character (_), property accessors, and operator overloading methods are examples of names that might require special treatment by some compilers.

The following example returns a value indicating whether or not the fields in the class contain a SpecialName attribute.

#using <system.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::ComponentModel::Design;

int main()
      // 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 );

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top