C# TypeInfo IsAnsiClass

Description

TypeInfo IsAnsiClass Gets a value indicating whether the string format attribute AnsiClass is selected for the Type.

Syntax

TypeInfo.IsAnsiClass has the following syntax.


public bool IsAnsiClass { get; }

Example

The following example gets the field information and checks for the AnsiClass attribute.


using System;/* ww w.j  a v  a2  s.  co m*/
using System.Reflection;
public class MyClass
{
    protected string myField = "A sample protected field." ;
}
public class MyType_IsAnsiClass
{
    public static void Main()
    {
        MyClass myObject = new MyClass();
        Type myType = typeof(MyClass);
        FieldInfo myFieldInfo = myType.GetField("myField", BindingFlags.NonPublic|BindingFlags.Instance);
        Console.WriteLine(myType.FullName);
        Console.WriteLine(myFieldInfo.GetValue(myObject));
        Console.WriteLine(myType.IsAnsiClass);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo