_Type.GetInterface メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > _Type.GetInterface メソッドの意味・解説 

_Type.GetInterface メソッド


Type.GetInterface メソッド (String)

指定した名前のインターフェイス検索します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

例外例外
例外種類条件

ArgumentNullException

namenull 参照 (Visual Basic では Nothing) です。

AmbiguousMatchException

現在の Type は、別の型引数で同じジェネリック インターフェイス実装する型を表します

解説解説
使用例使用例
   Public Shared Sub Main()
      Dim hashtableObj As New
 Hashtable()
      Dim objType As Type = hashtableObj.GetType()
      Dim arrayMemberInfo() As MemberInfo
      Dim arrayMethodInfo() As MethodInfo
      Try
         ' Get the methods implemented in 'IDeserializationCallback'
 interface.
         arrayMethodInfo = objType.GetInterface("IDeserializationCallback").GetMethods()
         Console.WriteLine(ControlChars.Cr + "Methods of
 'IDeserializationCallback' Interface :")
         Dim index As Integer
         For index = 0 To arrayMethodInfo.Length
 - 1
            Console.WriteLine(arrayMethodInfo(index).ToString())
         Next index
         ' Get FullName for interface by using Ignore case search.
         Console.WriteLine(ControlChars.Cr + "Methods of
 'IEnumerable' Interface")
         arrayMethodInfo = objType.GetInterface("ienumerable",
 True).GetMethods()
         For index = 0 To arrayMethodInfo.Length
 - 1
            Console.WriteLine(arrayMethodInfo(index).ToString())
         Next index
         'Get the Interface methods for 'IDictionary' interface
         Dim interfaceMappingObj As InterfaceMapping
         interfaceMappingObj = objType.GetInterfaceMap(GetType(IDictionary))
         arrayMemberInfo = interfaceMappingObj.InterfaceMethods
         Console.WriteLine(ControlChars.Cr + "Hashtable class
 Implements the following IDictionary Interface methods :")
         For index = 0 To arrayMemberInfo.Length
 - 1
            Console.WriteLine(arrayMemberInfo(index).ToString())
         Next index
      Catch e As Exception
         Console.WriteLine(("Exception : " + e.ToString()))
      End Try
   End Sub 'Main
End Class 'MyInterfaceClass 
public static void Main()
{
    Hashtable hashtableObj = new Hashtable();
    Type objType = hashtableObj.GetType();
    MemberInfo[] arrayMemberInfo;
    MethodInfo[] arrayMethodInfo;
    try
    {   
        // Get the methods implemented in 'IDeserializationCallback'
 interface.
        arrayMethodInfo =objType.GetInterface("IDeserializationCallback").GetMethods();
        Console.WriteLine ("\nMethods of 'IDeserializationCallback' Interface
 :");
        for(int index=0;index < arrayMethodInfo.Length
 ;index++)
            Console.WriteLine (arrayMethodInfo[index].ToString() ); 

        // Get FullName for interface by using Ignore case search.
        Console.WriteLine ("\nMethods of 'IEnumerable' Interface");
        arrayMethodInfo = objType.GetInterface("ienumerable",true).GetMethods();
        for(int index=0;index < arrayMethodInfo.Length
 ;index++)
           Console.WriteLine (arrayMethodInfo[index].ToString()); 
       
        //Get the Interface methods for 'IDictionary' interface
        InterfaceMapping interfaceMappingObj;
        interfaceMappingObj = objType.GetInterfaceMap(typeof(IDictionary));
        arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
        Console.WriteLine ("\nHashtable class Implements
 the following IDictionary Interface methods :");
        for(int index=0; index < arrayMemberInfo.Length;
 index++)
            Console.WriteLine (arrayMemberInfo[index].ToString() ); 
    }
    catch (Exception e)
    {
        Console.WriteLine ("Exception : " + e.ToString());            
    }                 
}
int main()
{
   Hashtable^ hashtableObj = gcnew Hashtable;
   Type^ objType = hashtableObj->GetType();
   array<MemberInfo^>^arrayMemberInfo;
   array<MethodInfo^>^arrayMethodInfo;
   try
   {
      // Get the methods implemented in 'IDeserializationCallback' interface.
      arrayMethodInfo = objType->GetInterface( "IDeserializationCallback"
 )->GetMethods();
      Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface
 :" );
      for ( int index = 0; index < arrayMethodInfo->Length;
 index++ )
         Console::WriteLine( arrayMethodInfo[ index ] );
      
      // Get FullName for interface by using Ignore case search.
      Console::WriteLine( "\nMethods of 'IEnumerable' Interface" );
      arrayMethodInfo = objType->GetInterface( "ienumerable", true
 )->GetMethods();
      for ( int index = 0; index < arrayMethodInfo->Length;
 index++ )
         Console::WriteLine( arrayMethodInfo[ index ] );
      
      //Get the Interface methods for 'IDictionary*' interface
      InterfaceMapping interfaceMappingObj;
      interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid );
      arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
      Console::WriteLine( "\nHashtable class Implements the
 following IDictionary Interface methods :" );
      for ( int index = 0; index < arrayMemberInfo->Length;
 index++ )
         Console::WriteLine( arrayMemberInfo[ index ] );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception : {0}", e );
   }
}
public static void main(String[]
 args)
{
    Hashtable hashtableObj = new Hashtable();
    Type objType = hashtableObj.GetType();
    MemberInfo arrayMemberInfo[];
    MethodInfo arrayMethodInfo[];
    try {
        // Get the methods implemented in 'IDeserializationCallback'
        // interface.
        arrayMethodInfo = objType.GetInterface("IDeserializationCallback").
            GetMethods();
        Console.WriteLine("\nMethods of 'IDeserializationCallback'"
            + " Interface :");
        for (int index = 0; index < arrayMethodInfo.length;
 index++) {
            Console.WriteLine(arrayMethodInfo.get_Item(index).ToString());
        }
        // Get FullName for interface by using Ignore case search.
        Console.WriteLine("\nMethods of 'IEnumerable' Interface");
        arrayMethodInfo = objType.GetInterface("ienumerable", true).
            GetMethods();
        for (int index = 0; index < arrayMethodInfo.length;
 index++) {
            Console.WriteLine(arrayMethodInfo.get_Item(index).ToString());
        }
        //Get the Interface methods for 'IDictionary' interface
        InterfaceMapping interfaceMappingObj;
        interfaceMappingObj =
            objType.GetInterfaceMap(IDictionary.class.ToType());
        arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
        Console.WriteLine("\nHashtable class Implements the
 following"
            + " IDictionary Interface methods :");
        for (int index = 0; index < arrayMemberInfo.length;
 index++) {
            Console.WriteLine(arrayMemberInfo.get_Item(index).ToString());
        }
    }
    catch (System.Exception e) {
        Console.WriteLine("Exception : " + e.ToString());
    }
} //main
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.GetInterface メソッド


Type.GetInterface メソッド (String, Boolean)

派生クラスオーバーライドされた場合大文字と小文字区別するかどうか指定して指定したインターフェイス検索します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

例外例外
例外種類条件

ArgumentNullException

namenull 参照 (Visual Basic では Nothing) です。

AmbiguousMatchException

現在の Type は、別の型引数で同じジェネリック インターフェイス実装する型を表します

解説解説
使用例使用例
   Public Shared Sub Main()
      Dim hashtableObj As New
 Hashtable()
      Dim objType As Type = hashtableObj.GetType()
      Dim arrayMemberInfo() As MemberInfo
      Dim arrayMethodInfo() As MethodInfo
      Try
         ' Get the methods implemented in 'IDeserializationCallback'
 interface.
         arrayMethodInfo = objType.GetInterface("IDeserializationCallback").GetMethods()
         Console.WriteLine(ControlChars.Cr + "Methods of
 'IDeserializationCallback' Interface :")
         Dim index As Integer
         For index = 0 To arrayMethodInfo.Length
 - 1
            Console.WriteLine(arrayMethodInfo(index).ToString())
         Next index
         ' Get FullName for interface by using Ignore case search.
         Console.WriteLine(ControlChars.Cr + "Methods of
 'IEnumerable' Interface")
         arrayMethodInfo = objType.GetInterface("ienumerable",
 True).GetMethods()
         For index = 0 To arrayMethodInfo.Length
 - 1
            Console.WriteLine(arrayMethodInfo(index).ToString())
         Next index
         'Get the Interface methods for 'IDictionary' interface
         Dim interfaceMappingObj As InterfaceMapping
         interfaceMappingObj = objType.GetInterfaceMap(GetType(IDictionary))
         arrayMemberInfo = interfaceMappingObj.InterfaceMethods
         Console.WriteLine(ControlChars.Cr + "Hashtable class
 Implements the following IDictionary Interface methods :")
         For index = 0 To arrayMemberInfo.Length
 - 1
            Console.WriteLine(arrayMemberInfo(index).ToString())
         Next index
      Catch e As Exception
         Console.WriteLine(("Exception : " + e.ToString()))
      End Try
   End Sub 'Main
End Class 'MyInterfaceClass 
public static void Main()
{
    Hashtable hashtableObj = new Hashtable();
    Type objType = hashtableObj.GetType();
    MemberInfo[] arrayMemberInfo;
    MethodInfo[] arrayMethodInfo;
    try
    {   
        // Get the methods implemented in 'IDeserializationCallback'
 interface.
        arrayMethodInfo =objType.GetInterface("IDeserializationCallback").GetMethods();
        Console.WriteLine ("\nMethods of 'IDeserializationCallback' Interface
 :");
        for(int index=0;index < arrayMethodInfo.Length
 ;index++)
            Console.WriteLine (arrayMethodInfo[index].ToString() ); 

        // Get FullName for interface by using Ignore case search.
        Console.WriteLine ("\nMethods of 'IEnumerable' Interface");
        arrayMethodInfo = objType.GetInterface("ienumerable",true).GetMethods();
        for(int index=0;index < arrayMethodInfo.Length
 ;index++)
           Console.WriteLine (arrayMethodInfo[index].ToString()); 
       
        //Get the Interface methods for 'IDictionary' interface
        InterfaceMapping interfaceMappingObj;
        interfaceMappingObj = objType.GetInterfaceMap(typeof(IDictionary));
        arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
        Console.WriteLine ("\nHashtable class Implements
 the following IDictionary Interface methods :");
        for(int index=0; index < arrayMemberInfo.Length;
 index++)
            Console.WriteLine (arrayMemberInfo[index].ToString() ); 
    }
    catch (Exception e)
    {
        Console.WriteLine ("Exception : " + e.ToString());            
    }                 
}
int main()
{
   Hashtable^ hashtableObj = gcnew Hashtable;
   Type^ objType = hashtableObj->GetType();
   array<MemberInfo^>^arrayMemberInfo;
   array<MethodInfo^>^arrayMethodInfo;
   try
   {
      // Get the methods implemented in 'IDeserializationCallback' interface.
      arrayMethodInfo = objType->GetInterface( "IDeserializationCallback"
 )->GetMethods();
      Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface
 :" );
      for ( int index = 0; index < arrayMethodInfo->Length;
 index++ )
         Console::WriteLine( arrayMethodInfo[ index ] );
      
      // Get FullName for interface by using Ignore case search.
      Console::WriteLine( "\nMethods of 'IEnumerable' Interface" );
      arrayMethodInfo = objType->GetInterface( "ienumerable", true
 )->GetMethods();
      for ( int index = 0; index < arrayMethodInfo->Length;
 index++ )
         Console::WriteLine( arrayMethodInfo[ index ] );
      
      //Get the Interface methods for 'IDictionary*' interface
      InterfaceMapping interfaceMappingObj;
      interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid );
      arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
      Console::WriteLine( "\nHashtable class Implements the
 following IDictionary Interface methods :" );
      for ( int index = 0; index < arrayMemberInfo->Length;
 index++ )
         Console::WriteLine( arrayMemberInfo[ index ] );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception : {0}", e );
   }
}
public static void main(String[]
 args)
{
    Hashtable hashtableObj = new Hashtable();
    Type objType = hashtableObj.GetType();
    MemberInfo arrayMemberInfo[];
    MethodInfo arrayMethodInfo[];
    try {
        // Get the methods implemented in 'IDeserializationCallback'
        // interface.
        arrayMethodInfo = objType.GetInterface("IDeserializationCallback").
            GetMethods();
        Console.WriteLine("\nMethods of 'IDeserializationCallback'"
            + " Interface :");
        for (int index = 0; index < arrayMethodInfo.length;
 index++) {
            Console.WriteLine(arrayMethodInfo.get_Item(index).ToString());
        }
        // Get FullName for interface by using Ignore case search.
        Console.WriteLine("\nMethods of 'IEnumerable' Interface");
        arrayMethodInfo = objType.GetInterface("ienumerable", true).
            GetMethods();
        for (int index = 0; index < arrayMethodInfo.length;
 index++) {
            Console.WriteLine(arrayMethodInfo.get_Item(index).ToString());
        }
        //Get the Interface methods for 'IDictionary' interface
        InterfaceMapping interfaceMappingObj;
        interfaceMappingObj =
            objType.GetInterfaceMap(IDictionary.class.ToType());
        arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
        Console.WriteLine("\nHashtable class Implements the
 following"
            + " IDictionary Interface methods :");
        for (int index = 0; index < arrayMemberInfo.length;
 index++) {
            Console.WriteLine(arrayMemberInfo.get_Item(index).ToString());
        }
    }
    catch (System.Exception e) {
        Console.WriteLine("Exception : " + e.ToString());
    }
} //main
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「_Type.GetInterface メソッド」の関連用語

_Type.GetInterface メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



_Type.GetInterface メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS