ImportedFromTypeLibAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<AttributeUsageAttribute(AttributeTargets.Assembly, Inherited:=False)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ImportedFromTypeLibAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Assembly, Inherited=false)] [ComVisibleAttribute(true)] public sealed class ImportedFromTypeLibAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly, Inherited=false)] [ComVisibleAttribute(true)] public ref class ImportedFromTypeLibAttribute sealed : public Attribute

この属性は、タイプ ライブラリをインポートするときに タイプ ライブラリ インポータ (Tlbimp.exe) が基本的に自動適用しますが、アセンブリに適用することもできます。
この属性の主な用途は、型情報の元の定義を取得することです。たとえば、A.tlb を相互運用機能アセンブリ A.dll としてインポートし、アセンブリ B.dll に A.dll を参照させることもできます。B.dll を B.tlb にエクスポートすると、この属性によって、A.dll を指す B.tlb 内の参照は代わりに A.tlb を指すようになります。これを、個々の型が COM で実装されていることを示す ComImportAttribute と混同しないよう注意してください。

Imports System Imports System.Reflection Imports System.Runtime.InteropServices Module A Public Function IsCOMAssembly(ByVal a As System.Reflection.Assembly) As Boolean Dim AsmAttributes As Object() = a.GetCustomAttributes(GetType(ImportedFromTypeLibAttribute), True) If AsmAttributes.Length = 1 Then Dim imptlb As ImportedFromTypeLibAttribute = AsmAttributes(0) Dim strImportedFrom As String = imptlb.Value ' Print out the the name of the DLL from which the assembly is imported. Console.WriteLine("Assembly " + a.FullName + " is imported from " + strImportedFrom) Return True End If ' This is not a COM assembly. Console.WriteLine("Assembly " + a.FullName + " is not imported from COM") Return False End Function End Module
using System; using System.Reflection; using System.Runtime.InteropServices; namespace A { class ClassA { public static bool IsCOMAssembly( Assembly a ) { object[] AsmAttributes = a.GetCustomAttributes( typeof( ImportedFromTypeLibAttribute ), true ); if( AsmAttributes.Length > 0 ) { ImportedFromTypeLibAttribute imptlb = ( ImportedFromTypeLibAttribute )AsmAttributes[0]; string strImportedFrom = imptlb.Value; // Print out the the name of the DLL from which the assembly is imported. Console.WriteLine( "Assembly " + a.FullName + " is imported from " + strImportedFrom ); return true; } // This is not a COM assembly. Console.WriteLine( "Assembly " + a.FullName + " is not imported from COM" ); return false; } } }
using namespace System; using namespace System::Reflection; using namespace System::Runtime::InteropServices; class ClassA { private: static bool IsCOMAssembly( Assembly^ a ) { array<Object^>^AsmAttributes = a->GetCustomAttributes( ImportedFromTypeLibAttribute::typeid, true ); if ( AsmAttributes->Length > 0 ) { ImportedFromTypeLibAttribute^ imptlb = dynamic_cast<ImportedFromTypeLibAttribute^>(AsmAttributes[ 0 ]); String^ strImportedFrom = imptlb->Value; // Print out the name of the DLL from which the assembly is imported. Console::WriteLine( "Assembly {0} is imported from {1}", a->FullName, strImportedFrom ); return true; } // This is not a COM assembly. Console::WriteLine( "Assembly {0} is not imported from COM", a->FullName ); return false; } };
import System.*; import System.Reflection.*; import System.Runtime.InteropServices.*; class ClassA { public static boolean IsCOMAssembly(Assembly a) { Object asmAttributes[] = a.GetCustomAttributes( ImportedFromTypeLibAttribute.class.ToType(), true); if (asmAttributes.length > 0) { ImportedFromTypeLibAttribute imptlb = (ImportedFromTypeLibAttribute)(asmAttributes.get_Item(0)); String strImportedFrom = imptlb.get_Value(); // Print out the the name of the DLL from which // the assembly is imported. Console.WriteLine("Assembly " + a.get_FullName() + " is imported from " + strImportedFrom); return true; } // This is not a COM assembly. Console.WriteLine("Assembly " + a.get_FullName() + " is not imported from COM"); return false; } //IsCOMAssembly } //ClassA

System.Attribute
System.Runtime.InteropServices.ImportedFromTypeLibAttribute


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


Weblioに収録されているすべての辞書からImportedFromTypeLibAttribute クラスを検索する場合は、下記のリンクをクリックしてください。

- ImportedFromTypeLibAttribute クラスのページへのリンク