Auf Englisch lesen

Freigeben über


AppDomain.ClearPrivatePath Methode

Definition

Achtung

AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202

Achtung

AppDomain.ClearPrivatePath has been deprecated and is not supported.

Achtung

AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202

Setzt den Pfad, der den Speicherort von privaten Assemblys angibt, auf die leere Zeichenfolge ("") zurück.

C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated and is not supported.")]
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public void ClearPrivatePath();
C#
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Security.SecurityCritical]
public void ClearPrivatePath();

Implementiert

Attribute

Ausnahmen

Der Vorgang wird für eine entladene Anwendungsdomäne ausgeführt.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie die ClearPrivatePath -Methode verwendet wird, um alle Einträge aus der Liste der privaten Pfade zu entfernen, die beim Laden von Assemblys gesucht werden.

Diese Methode ist jetzt veraltet und sollte nicht für die Neuentwicklung verwendet werden.

C#
using System;
using System.Reflection;
using System.Security.Policy;

class ADAppendPrivatePath
{
    public static void Main()
    {
        //Create evidence for new appdomain.
        Evidence adevidence = AppDomain.CurrentDomain.Evidence;

        //Create the new application domain.
        AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence);

        //Display the current relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Append the relative path.
        String Newpath = "www.code.microsoft.com";
        domain.AppendPrivatePath(Newpath);

        //Display the new relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Clear the private search path.
        domain.ClearPrivatePath();

        //Display the new relative search path.
        Console.WriteLine("Relative search path is now: " + domain.RelativeSearchPath);

        AppDomain.Unload(domain);	
    }
}

Hinweise

Der private Pfad ist ein Pfad relativ zum Basisverzeichnis, durch das die Common Language Runtime nach privaten Assemblys sucht.

Weitere Informationen finden Sie unter AppDomainSetup.PrivateBinPath.

Gilt für:

Produkt Versionen (Veraltet)
.NET (Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9)
.NET Framework 1.1 (2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1)
.NET Standard (2.0, 2.1)

Weitere Informationen