Type.GetTypeArray(Object[]) メソッド
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した配列内のオブジェクトの型を取得します。
public:
static cli::array <Type ^> ^ GetTypeArray(cli::array <System::Object ^> ^ args);
C#
public static Type[] GetTypeArray (object[] args);
static member GetTypeArray : obj[] -> Type[]
Public Shared Function GetTypeArray (args As Object()) As Type()
- args
- Object[]
型を確認する対象のオブジェクトの配列。
Type[]
args
内の対応する要素の型を表す Type オブジェクトの配列。
クラスの初期化子が呼び出され、少なくとも 1 つは例外をスローします。
次のコード例では、 メソッドを使用して配列の GetTypeArray 要素の型を一覧表示する方法を示します。
array<Object^>^myObject = gcnew array<Object^>(3);
myObject[ 0 ] = 66;
myObject[ 1 ] = "puri";
myObject[ 2 ] = 33.33;
// Get the array of 'Type' class objects.
array<Type^>^myTypeArray = Type::GetTypeArray( myObject );
Console::WriteLine( "Full names of the 'Type' objects in the array are:" );
for ( int h = 0; h < myTypeArray->Length; h++ )
{
Console::WriteLine( myTypeArray[ h ]->FullName );
}
C#
Object[] myObject = new Object[3];
myObject[0] = 66;
myObject[1] = "puri";
myObject[2] = 33.33;
// Get the array of 'Type' class objects.
Type[] myTypeArray = Type.GetTypeArray(myObject);
Console.WriteLine("Full names of the 'Type' objects in the array are:");
for(int h = 0; h < myTypeArray.Length ; h++)
{
Console.WriteLine(myTypeArray[h].FullName);
}
let myObject = Array.zeroCreate<obj> 3
myObject[0] <- 66
myObject[1] <- "puri"
myObject[2] <- 33.33
// Get the array of 'Type' class objects.
let myTypeArray = Type.GetTypeArray myObject
printfn "Full names of the 'Type' objects in the array are:"
for h in myTypeArray do
printfn $"{h.FullName}"
Dim myObject(2) As Object
myObject(0) = 66
myObject(1) = "puri"
myObject(2) = 33.33
' Get the array of 'Type' class objects.
Dim myTypeArray As Type() = Type.GetTypeArray(myObject)
Console.WriteLine("Full names of the 'Type' objects in the array are:")
Dim h As Integer
For h = 0 To myTypeArray.Length - 1
Console.WriteLine(myTypeArray(h).FullName)
Next h
製品 | バージョン |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。