This documentation is archived and is not being maintained.

AppDomain.FriendlyName Property

Gets the friendly name of this application domain.

[Visual Basic]
Public Overridable ReadOnly Property FriendlyName As String  _
   Implements _AppDomain.FriendlyName
public virtual string FriendlyName {get;}
public: __property virtual String* get_FriendlyName();
public function get FriendlyName() : String;

Property Value

The friendly name of this application domain.




Exception Type Condition
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 codebase. 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".


[Visual Basic] 
Imports System
Imports System.Reflection
Imports System.Security.Policy 'for evidence object

Class ADSetupInformation
   Public Shared Sub Main()
      ' Create the applcation domain setup information.
      Dim domaininfo As New AppDomainSetup()
      domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory
      'Create evidence for the new appdomain.
      Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
      ' Create the new application domain using setup information.
      Dim domain As AppDomain = 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(("Application base is: " + domain.SetupInformation.ApplicationBase))
   End Sub 'Main 
End Class 'ADSetupInformation 


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 = "file:///" + 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("Application base is: " + domain.SetupInformation.ApplicationBase);



#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;  //for evidence Object

int 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(S"MyDomain", adevidence, domaininfo);

    // Write Out the application domain information.
    Console::WriteLine(S"Host domain: {0}", AppDomain::CurrentDomain->FriendlyName);
    Console::WriteLine(S"new child domain: {0}", domain->FriendlyName);
    Console::WriteLine(S"Application base is: {0}", domain->SetupInformation->ApplicationBase);


[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

AppDomain Class | AppDomain Members | System Namespace