FriendlyName Property

AppDomain.FriendlyName Property

Gets the friendly name of this application domain.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public string FriendlyName { get; }
/** @property */
public final String get_FriendlyName ()

public final function get FriendlyName () : String

Property Value

The friendly name of this application domain.

Exception typeCondition

AppDomainUnloadedException

Operations are attempted on an unloaded application domain.

The friendly name of the default application domain is the name of the assembly file loaded in the application domain. The friendly name is formed by stripping the directory specification from the assembly's code base. For example, if an assembly with the file name "c:\MyAppDirectory\MyAssembly.exe" is loaded in the default application domain, the friendly name of that application domain is "MyAssembly.exe".


using System;
using System.Reflection;
using System.Security.Policy;  //for evidence object

class ADSetupInformation
{
	public static void Main()
	{
		//Create the application domain setup information.
		AppDomainSetup domaininfo = new AppDomainSetup();
		domaininfo.ApplicationBase = System.Environment.CurrentDirectory;
		//Create evidence for new appdomain.
		Evidence adevidence = AppDomain.CurrentDomain.Evidence;
		// Create the new application domain using setup information.
		AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);

		// Write out the application domain information.
            Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
            Console.WriteLine("new child domain: " + domain.FriendlyName);
            Console.WriteLine();
            Console.WriteLine("Application base is: " + domain.SetupInformation.ApplicationBase);

		AppDomain.Unload(domain);
	
		
	}
	
}

import System.*;
import System.Reflection.*;
import System.Security.Policy.*; //for evidence object

class ADSetupInformation
{
    public static void main(String[] args)
    {
        //Create the application domain setup information.
        AppDomainSetup domainInfo = new AppDomainSetup();

        domainInfo.set_ApplicationBase(System.Environment.get_CurrentDirectory());

        //Create evidence for new appdomain.
        Evidence adEvidence = AppDomain.get_CurrentDomain().get_Evidence();

        // Create the new application domain using setup information.
        AppDomain domain = AppDomain.CreateDomain("MyDomain", adEvidence, 
            domainInfo);

        // Write out the application domain information.
        Console.WriteLine("Host domain: " 
            + AppDomain.get_CurrentDomain().get_FriendlyName());
        Console.WriteLine("new child domain: " 
            + domain.get_FriendlyName());
        Console.WriteLine();
        Console.WriteLine("Application base is: " 
            + domain.get_SetupInformation().get_ApplicationBase());

        AppDomain.Unload(domain);
    } //main 
} //ADSetupInformation 

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2016 Microsoft