Type.IsAnsiClass プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


StringFormatMask は、文字列書式属性を選択します。文字書式属性は、文字列の解釈方法を定義することによって、相互運用性を拡張します。
現在の Type がジェネリック型を表している場合、このプロパティは型が構築される元になったジェネリック型定義に関連します。たとえば、現在の Type が MyGenericType<int> (Visual Basic では MyGenericType(Of Integer)) を表す場合、このプロパティの値は MyGenericType<T> によって決まります。

フィールド情報を取得し、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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_Type.IsAnsiClass プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)

Type に、文字列書式属性として AnsiClass が選択されている場合は true。それ以外の場合は false。

このプロパティは、アンマネージ コードからマネージ クラスにアクセスするためのプロパティであるため、マネージ コードからは呼び出さないでください。
Type.IsAnsiClass プロパティは、Type に、文字列書式属性として AnsiClass が選択されているかどうかを示す値を取得します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からType.IsAnsiClassを検索する場合は、下記のリンクをクリックしてください。

- Type.IsAnsiClassのページへのリンク