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

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

_Type.GetInterfaces メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、Type.GetInterfaces メソッドへのバージョン依存しないアクセス用意されています。

このメソッドは、CLS準拠していません。  

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

Function GetInterfaces As Type()
Type[] GetInterfaces ()
array<Type^>^ GetInterfaces ()
Type[] GetInterfaces ()
function GetInterfaces () : Type[]

戻り値
現在の Type実装または継承されているすべてのインターフェイスを表す Type オブジェクト配列。 または 現在の Type実装または継承されているインターフェイス存在しない場合は、Type 型の空の配列

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.GetInterfaces メソッド

派生クラスによってオーバーライドされた場合現在の Type実装または継承されているすべてのインターフェイス取得します

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

例外例外
解説解説
使用例使用例

指定したクラスの型を取得し、その型が実装または継承しているすべてのインターフェイス表示する例を示しますVisual Basic の例をコンパイルするには、次のコンパイラ コマンド使用します

vbc type_getinterfaces1.vb /r:System.Web.dll /r:System.dll

Imports System
Imports System.Web
Imports System.Web.UI
Imports Microsoft.VisualBasic

Namespace Samples
    Public Class MyTemplate
        Inherits Control
        Implements INamingContainer
        Private _message As [String] = Nothing
        Public Property Message() As
 [String]
            Get
                Return _message
            End Get
            Set(ByVal Value As
 [String])
                _message = value
            End Set
        End Property
    End Class
    Public Class MyInterfacesSample
        Public Shared Sub
 Main()
            Try
                Dim myObjectArray As Type()
 = GetType(MyTemplate).GetInterfaces()
                Console.WriteLine("The interfaces inherited by
 the MyTemplate class are:" + ControlChars.CrLf)
                Dim index As Integer
                For index = 0 To myObjectArray.Length
 - 1
                    Console.WriteLine(myObjectArray(index))
                Next index
            Catch e As Exception
                Console.WriteLine("An exception occurred.")
                Console.WriteLine("Message: {0}",
 e.Message)
            End Try
        End Sub
    End Class
End Namespace
using System;
using System.Web;
using System.Web.UI;

namespace Samples
{
    public class MyTemplate : Control, INamingContainer
 
    {
        private String _message = null;
        public String Message 
        {
            get 
            {
                return _message;
            }
            set 
            {
                _message = value;
            }
        }    
    }
    public class MyInterfacesSample
    {
        public static void
 Main()
        {
            try
            {
                Type[] myObjectArray= typeof(MyTemplate).GetInterfaces();
                Console.WriteLine("The interfaces inherited by the MyTemplate
 class are:\n");
                for (int index = 0; index <
 myObjectArray.Length; index++)
                {    
                    Console.WriteLine(myObjectArray[index]);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception occurred.");
                Console.WriteLine("Message: " + e.Message);
            }
        }
    }
}
#using <system.dll>
#using <system.web.dll>

using namespace System;
using namespace System::Web;
using namespace System::Web::UI;

public ref class MyTemplate: public
 Control, public INamingContainer
{
private:
   String^ _message;

public:

   property String^ Message 
   {
      String^ get()
      {
         return _message;
      }

      void set( String^ value )
      {
         _message = value;
      }

   }
};

int main()
{
   try
   {
      array<Type^>^myObjectArray = MyTemplate::typeid->GetInterfaces();
      Console::WriteLine( "The interfaces inherited by the MyTemplate class
 are:\n" );
      for ( int index = 0; index < myObjectArray->Length;
 index++ )
      {
         Console::WriteLine( myObjectArray[ index ] );

      }
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "An exception occurred." );
      Console::WriteLine( "Message: {0}", e->Message );
   }
}
package Samples;

import System.*;
import System.Web.*;
import System.Web.UI.*;

public class MyTemplate extends Control implements
 INamingContainer
{
    private String _message = null;

    /** @property 
     */
    public String get_Message()
    {
        return _message;
    } //get_Message

    /** @property 
     */
    public void set_Message(String value)
    {
        _message = value;
    } //set_Message
} //MyTemplate

public class MyInterfacesSample
{
    public static void main(String[]
 args)
    {
        try {
            Type myObjectArray[] = MyTemplate.class.ToType().GetInterfaces();
            Console.WriteLine("The interfaces inherited by the MyTemplate"
                + " class are:\n");
            for (int index = 0; index <
 myObjectArray.length; index++) {
                Console.WriteLine(myObjectArray.get_Item(index));
            }
        }
        catch (System.Exception e) {
            Console.WriteLine("An exception occurred.");
            Console.WriteLine("Message: " + e.get_Message());
        }
    } //main
} //MyInterfacesSample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2024 GRAS Group, Inc.RSS