Type.IsAnsiClass 속성

Type에 대해 문자열 형식 특성 AnsiClass가 선택되었는지 여부를 나타내는 값을 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public ReadOnly Property IsAnsiClass As Boolean
‘사용 방법
Dim instance As Type
Dim value As Boolean

value = instance.IsAnsiClass
public bool IsAnsiClass { get; }
public:
virtual property bool IsAnsiClass {
    bool get () sealed;
}
/** @property */
public final boolean get_IsAnsiClass ()
public final function get IsAnsiClass () : boolean

속성 값

Type에 대해 문자열 형식 특성 AnsiClass가 선택되면 true이고, 그렇지 않으면 false입니다.

설명

StringFormatMask에서는 문자열 형식 특성을 선택합니다. 문자열 형식 특성은 문자열 해석 방법을 정의하여 상호 운용성을 개선합니다.

현재 Type이 제네릭 형식을 나타내는 경우 이 속성은 형식이 생성된 제네릭 형식 정의에 적용됩니다. 예를 들어, 현재 TypeMyGenericType<int>(Visual Basic의 경우 MyGenericType(Of Integer))을 나타내는 경우 이 속성의 값은 MyGenericType<T>에 의해 결정됩니다.

현재 Type이 제네릭 형식의 형식 매개 변수를 나타내는 경우 이 속성은 언제나 false를 반환합니다.

예제

다음 예제에서는 필드 정보를 가져오고 AnsiClass 특성을 확인합니다.

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public Class MyClass1
    Protected myField As String = "A sample protected field."
End Class 'MyClass1
Public Class MyType_IsAnsiClass
    Public Shared Sub Main()
        Try
            Dim myObject As New MyClass1()
            ' Get the type of MyClass1.
            Dim myType As Type = GetType(MyClass1)
            ' Get the field information and the attributes associated with MyClass1.
            Dim myFieldInfo As FieldInfo = myType.GetField("myField", BindingFlags.NonPublic Or BindingFlags.Instance)

            Console.WriteLine(ControlChars.NewLine + "Checking for AnsiClass attribute for a field." + ControlChars.NewLine)
            ' Get and display the name, field, and the AnsiClass attribute.
            Console.WriteLine("Name of Class: {0} " + ControlChars.NewLine + "Value of Field: {1} " + ControlChars.NewLine + "IsAnsiClass = {2}", myType.FullName, myFieldInfo.GetValue(myObject), myType.IsAnsiClass)
        Catch e As Exception
            Console.WriteLine("Exception: {0}", e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'MyType_IsAnsiClass
using System;
using System.Reflection;
public class MyClass
{
    protected string myField = "A sample protected field." ;
}
public class MyType_IsAnsiClass
{
    public static void Main()
    {
        try
        {
            MyClass myObject = new MyClass();
            // Get the type of the 'MyClass'.
            Type myType = typeof(MyClass);
            // Get the field information and the attributes associated with MyClass.
            FieldInfo myFieldInfo = myType.GetField("myField", BindingFlags.NonPublic|BindingFlags.Instance);
            Console.WriteLine( "\nChecking for the AnsiClass attribute for a field.\n"); 
            // Get and display the name, field, and the AnsiClass attribute.
            Console.WriteLine("Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType.FullName, myFieldInfo.GetValue(myObject), myType.IsAnsiClass);
        }
        catch(Exception e)
        {
            Console.WriteLine("Exception: {0}",e.Message);
        }
    }
}
using namespace System;
using namespace System::Reflection;
public ref class MyClass
{
protected:
   String^ myField;

public:
   MyClass()
   {
      myField =  "A sample protected field";
   }
};

int main()
{
   try
   {
      MyClass^ myObject = gcnew MyClass;
      
      // Get the type of the 'MyClass'.
      Type^ myType = MyClass::typeid;
      
      // Get the field information and the attributes associated with MyClass.
      FieldInfo^ myFieldInfo = myType->GetField( "myField", static_cast<BindingFlags>(BindingFlags::NonPublic | BindingFlags::Instance) );
      Console::WriteLine( "\nChecking for the AnsiClass attribute for a field.\n" );
      
      // Get and display the name, field, and the AnsiClass attribute.
      Console::WriteLine( "Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType->FullName, myFieldInfo->GetValue( myObject ), myType->IsAnsiClass );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
import System.*;
import System.Reflection.*;
public class MyClass
{
    protected String myField = "A sample protected field.";
} //MyClass

public class MyType_IsAnsiClass
{
    public static void main(String[] args)
    {
        try {
            MyClass myObject = new MyClass();
            // Get the type of the 'MyClass'.
            Type myType = MyClass.class.ToType();
            // Get the field information and the attributes associated with
            // MyClass.
            FieldInfo myFieldInfo = myType.GetField("myField", BindingFlags.
                NonPublic | BindingFlags.Instance);
            Console.WriteLine("\nChecking for the AnsiClass attribute for" 
                + " a field.\n");
            // Get and display the name, field, and the AnsiClass attribute.
            Console.WriteLine("Name of Class: {0} \nValue of Field: {1} \n" 
                + "IsAnsiClass = {2}", myType.get_FullName(), myFieldInfo.
                GetValue(myObject), System.Convert.ToString(myType.
                get_IsAnsiClass()));
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception: {0}", e.get_Message());
        }
    } //main
} //MyType_IsAnsiClass

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
TypeAttributes
IsUnicodeClass
IsAutoClass