Assembly.Location Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar den fullständiga sökvägen eller UNC-platsen för den inlästa filen som innehåller manifestet.
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
Egenskapsvärde
Platsen för den inlästa filen som innehåller manifestet. Om sammansättningen läses in från en bytematris, till exempel när du använder Load(Byte[]), är värdet som returneras en tom sträng ("").
Implementeringar
Undantag
Den aktuella sammansättningen är en dynamisk sammansättning som representeras av ett AssemblyBuilder objekt.
Exempel
I följande exempel visas platsen för den inlästa filen som innehåller manifestet.
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
Kommentarer
I .NET 5 och senare versioner, för paketerade sammansättningar, är värdet som returneras en tom sträng.
endast .NET Framework: Om den inlästa filen shadow-kopierades är platsen för filen efter att ha kopierats. Om du vill hämta platsen innan filen har skuggkopierats använder du CodeBase egenskapen .