Assembly.Location Assembly.Location Assembly.Location Assembly.Location Property

정의

매니페스트가 포함된 로드된 파일의 전체 경로나 UNC 위치를 가져옵니다.Gets the full path or UNC location of the loaded file that contains the manifest.

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

속성 값

매니페스트가 포함된 로드된 파일의 위치입니다.The location of the loaded file that contains the manifest. 로드된 파일이 섀도 복사된 경우 위치는 해당 파일이 섀도 복사된 후의 위치입니다.If the loaded file was shadow-copied, the location is that of the file after being shadow-copied. Load(Byte[]) 메서드 오버로드를 사용한 경우처럼 어셈블리가 바이트 배열에서 로드되면 빈 문자열("")이 반환됩니다.If the assembly is loaded from a byte array, such as when using the Load(Byte[]) method overload, the value returned is an empty string ("").

구현

예외

현재 어셈블리가 AssemblyBuilder 개체로 표현되는 동적 어셈블리입니다.The current assembly is a dynamic assembly, represented by an AssemblyBuilder object.

예제

다음 예제에서는 매니페스트를 포함 하는 로드 된 파일의 위치를 표시 합니다.The following example displays the location of the loaded file that contains the manifest.

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() );
// Display the physical location of the assembly containing the manifest.
Console::WriteLine( "Location= {0}", SampleAssembly->Location );
// The example displays the following output:
//    Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll  
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());
// Display the physical location of the assembly containing the manifest.
Console.WriteLine("Location=" + SampleAssembly.Location);
// The example displays the following output:
//   Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
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())
' Display the physical location of the assembly containing the manifest.
Console.WriteLine(("Location=" + SampleAssembly.Location))
' The example displays the following output:
'    Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll

설명

위치를 가져오려면 파일이 섀도 복사 되기 전에 CodeBase 속성입니다.To get the location before the file has been shadow-copied, use the CodeBase property.

보안

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

적용 대상

추가 정보