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

Dim instance As DynamicMethod Dim value As ICustomAttributeProvider value = instance.ReturnTypeCustomAttributes
public: virtual property ICustomAttributeProvider^ ReturnTypeCustomAttributes { ICustomAttributeProvider^ get () override; }
動的メソッドの戻り値の型のカスタム属性を表す ICustomAttributeProvider。


動的メソッドの戻り値の型のカスタム属性を表示する方法を次のコード例に示します。このコード例は、DynamicMethod クラスのトピックで取り上げているコード例の一部分です。
' ReturnTypeCustomAttributes returns an ICustomeAttributeProvider ' that can be used to enumerate the custom attributes of the ' return value. At present, there is no way to set such custom ' attributes, so the list is empty. If hello.ReturnType Is GetType(System.Void) Then Console.WriteLine("The method has no return type.") Else Dim caProvider As ICustomAttributeProvider = _ hello.ReturnTypeCustomAttributes Dim returnAttributes() As Object = _ caProvider.GetCustomAttributes(True) If returnAttributes.Length = 0 Then Console.WriteLine(vbCrLf _ & "The return type has no custom attributes.") Else Console.WriteLine(vbCrLf _ & "The return type has the following custom attributes:") For Each attr As Object In returnAttributes Console.WriteLine(vbTab & attr.ToString()) Next attr End If End If
// ReturnTypeCustomAttributes returns an ICustomeAttributeProvider // that can be used to enumerate the custom attributes of the // return value. At present, there is no way to set such custom // attributes, so the list is empty. if (hello.ReturnType == typeof(void)) { Console.WriteLine("The method has no return type."); } else { ICustomAttributeProvider caProvider = hello.ReturnTypeCustomAttributes; object[] returnAttributes = caProvider.GetCustomAttributes(true); if (returnAttributes.Length==0) { Console.WriteLine("\r\nThe return type has no custom attributes."); } else { Console.WriteLine("\r\nThe return type has the following custom attributes:"); foreach( object attr in returnAttributes ) { Console.WriteLine("\t{0}", attr.ToString()); } } }

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


- DynamicMethod.ReturnTypeCustomAttributes プロパティのページへのリンク