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



読み込み済みマニフェストを格納しているファイルの絶対パスを取得するには、このプロパティではなく、Assembly.Location プロパティを使用します。
バイトの配列を受け取る Load メソッドのオーバーロードを使用して、アセンブリがバイト配列として読み込まれている場合、このプロパティは、読み込み済みアセンブリの場所ではなく、メソッドの呼び出し元の場所を返します。

CodeBase プロパティを使用する式を次の例に示します。
Dim SampleAssembly As [Assembly] ' Instantiate a target object. Dim Integer1 As New Int32() Dim Type1 As Type ' Set the Type instance to the target class type. Type1 = Integer1.GetType() ' Instantiate an Assembly class to the assembly housing the Integer type. SampleAssembly = [Assembly].GetAssembly(Integer1.GetType()) ' Gets the location of the assembly using file: protocol. Console.WriteLine(("CodeBase=" + SampleAssembly.CodeBase)) End Sub
Assembly SampleAssembly; // Instantiate a target object. Int32 Integer1 = new Int32(); Type Type1; // Set the Type instance to the target class type. Type1 = Integer1.GetType(); // Instantiate an Assembly class to the assembly housing the Integer type. SampleAssembly = Assembly.GetAssembly(Integer1.GetType()); // Gets the location of the assembly using file: protocol. Console.WriteLine("CodeBase=" + SampleAssembly.CodeBase);
Assembly^ SampleAssembly; // Instantiate a target object. Int32 Integer1(0); Type^ Type1; // Set the Type instance to the target class type. Type1 = Integer1.GetType(); // Instantiate an Assembly class to the assembly housing the Integer type. SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); // Gets the location of the assembly using file: protocol. Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase );
var SampleAssembly : Assembly; // Instantiate a target object. var Integer1 : Int32 = 0; var Type1 : Type; // Set the Type instance to the target class type. Type1 = Integer1.GetType(); // Instantiate an Assembly class to the assembly housing the Integer type. SampleAssembly = Assembly.GetAssembly(Integer1.GetType()); // Gets the location of the assembly using file: protocol. Console.WriteLine("CodeBase=" + SampleAssembly.CodeBase);


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


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


このメソッドは、アンマネージ コードからマネージ クラスにアクセスするためのメソッドであるため、マネージ コードからは呼び出さないでください。
Assembly.CodeBase プロパティは、アセンブリの場所を初めに指定されたとおりに取得します。たとえば、AssemblyName オブジェクトなどがあります。

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


- Assembly.CodeBaseのページへのリンク