PropertyInfo.PropertyType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)
構文public abstract Type PropertyType { get; }
/** @property */ public abstract Type get_PropertyType ()
このプロパティの型。
解説PropertyType プロパティを取得するには、最初に Type クラスを取得します。そして、その Type から PropertyInfo を取得します。最後に、PropertyInfo から PropertyType を取得します。
使用例Imports System Imports System.Reflection Imports Microsoft.VisualBasic Namespace MyNamespace Public Class Example Public ReadOnly Property Answer As Integer Get Return 42 End Get End Property Public Shared Sub Main() ' Get a Type object for the Example type. Dim t As Type = GetType(MyNamespace.Example) ' Get a PropertyInfo object for the Answer property. Dim pi As PropertyInfo = t.GetProperty("Answer") ' Display the type returned by the Answer property. Console.WriteLine("The return type of the {0}.{1} property is {2}.", _ t.Name, pi.Name, pi.PropertyType) End Sub End Class End Namespace
using System; using System.Reflection; namespace MyNamespace { public class Example { public int Answer { get { return 42; } } public static void Main() { // Get a Type object for the Example type. Type t = typeof(MyNamespace.Example); // Get a PropertyInfo object for the Answer property. PropertyInfo pi = t.GetProperty("Answer"); // Display the type returned by the Answer property. Console.WriteLine("The return type of the {0}.{1} property is {2}.", t.Name, pi.Name, pi.PropertyType); } } }
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照_PropertyInfo.PropertyType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)
構文
解説
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- _PropertyInfo.PropertyTypeのページへのリンク