FieldInfo.IsSpecialName FieldInfo.IsSpecialName FieldInfo.IsSpecialName FieldInfo.IsSpecialName Property

정의

해당 SpecialName 특성이 FieldAttributes 열거자에 설정되어 있는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the corresponding SpecialName attribute is set in the FieldAttributes enumerator.

public:
 property bool IsSpecialName { bool get(); };
public bool IsSpecialName { get; }
member this.IsSpecialName : bool
Public ReadOnly Property IsSpecialName As Boolean

속성 값

true 특성이 FieldAttributes에 설정되어 있으면 SpecialName이고, 그렇지 않으면 false입니다.true if the SpecialName attribute is set in FieldAttributes; otherwise, false.

구현

예제

다음 예제에서는 클래스의 필드는 SpecialName 특성을 포함 하는지 여부를 나타내는 값을 반환 합니다.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()
{
   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 );
   }
}
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);
        }
    }
}
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

설명

로 시작 하거나 밑줄 문자 (), 속성 접근자 및 메서드를 오버 로드할 연산자를 포함 하는 이름을 일부 컴파일러에서 특수 하 게 처리 해야 하는 이름의 예입니다.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.

적용 대상

추가 정보