Assembly.CodeBase 속성

정의

예를 들어 AssemblyName 개체에 원래 지정된 어셈블리 위치를 가져옵니다.Gets the location of the assembly as specified originally, for example, in an AssemblyName object.

public:
 virtual property System::String ^ CodeBase { System::String ^ get(); };
public virtual string CodeBase { get; }
member this.CodeBase : string
Public Overridable ReadOnly Property CodeBase As String

속성 값

원래 지정된 어셈블리 위치입니다.The location of the assembly as specified originally.

구현

예제

다음 예에서는 CodeBase 속성을 사용 합니다.The following example uses the CodeBase property.

using namespace System;
using namespace System::Reflection;

void main()
{
   // Instantiate a target object.
   int integer1 = 1632;
   // Instantiate an Assembly class to the assembly housing the Integer type.
   Assembly^ systemAssembly = integer1.GetType()->Assembly;
   // Get the location of the assembly using the file: protocol.
   Console::WriteLine("CodeBase = {0}", systemAssembly->CodeBase);
}
// The example displays output like the following:
//   CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
using System;
using System.Reflection;

public class Example
{
   public static void Main()
   {
      // Instantiate a target object.
      Int32 integer1 = 1632;
      // Instantiate an Assembly class to the assembly housing the Integer type.
      Assembly systemAssembly = integer1.GetType().Assembly;
      // Get the location of the assembly using the file: protocol.
      Console.WriteLine("CodeBase = {0}", systemAssembly.CodeBase);
   }
}
// The example displays output like the following:
//    CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
Imports System.Reflection

Module Example
   Public Sub Main()
      ' Instantiate a target object.
      Dim integer1 As Integer = 1632
      ' Instantiate an Assembly class to the assembly housing the Integer type.
      Dim systemAssembly As Assembly = integer1.GetType().Assembly
      ' Get the location of the assembly using the file: protocol.
      Console.WriteLine("CodeBase = {0}", systemAssembly.CodeBase)
   End Sub
End Module
' The example displays output like the following:
'   CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

설명

로드 된 매니페스트를 포함 하는 파일의 절대 경로를 가져오려면 대신 Assembly.Location 속성을 사용 합니다.To get the absolute path to the loaded manifest-containing file, use the Assembly.Location property instead.

어셈블리가 바이트 배열로 로드 된 경우 바이트 배열을 사용 하는 Load 메서드의 오버 로드를 사용 하 여이 속성은 로드 된 어셈블리의 위치가 아니라 메서드의 호출자 위치를 반환 합니다.If the assembly was loaded as a byte array, using an overload of the Load method that takes an array of bytes, this property returns the location of the caller of the method, not the location of the loaded assembly.

보안

FileIOPermission
경로에 대 한 액세스for access to the path. 연결 된 열거형: PathDiscoveryAssociated enumeration: PathDiscovery

적용 대상