Export (0) Print
Expand All

AppDomain.ToString Method

Obtains the String representation of this instance.

[Visual Basic]
Overrides Public Function ToString() As String Implements _
   _AppDomain.ToString
[C#]
public override string ToString();
[C++]
public: String* ToString();
[JScript]
public override function ToString() : String;

Return Value

The friendly name of the application domain.

Implements

_AppDomain.ToString

Remarks

The string representation specifies the friendly name of the application domain.

Example

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

Class ADSetup
   
   Public Shared Sub Main()
      ' Create application domain setup information
      Dim domaininfo As New AppDomainSetup()
      
      'Create evidence for the new appdomain from evidence of the current application domain
      Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
      
      ' Create appdomain
      Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo)
      
      ' Write out application domain information
      Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
      Console.WriteLine(("child domain: " + domain.FriendlyName))
      Console.WriteLine(("child domain name using ToString:" + domain.ToString()))
      Console.WriteLine()
      
      AppDomain.Unload(domain)
   End Sub 'Main 
End Class 'ADSetup


[C#] 
using System;
using System.Reflection;
using System.Security.Policy;  //for evidence object
class ADSetup
{
    public static void Main()
    {
        // Create application domain setup information
        AppDomainSetup domaininfo = new AppDomainSetup();
        
        //Create evidence for the new appdomain from evidence of the current application domain
        Evidence adevidence = AppDomain.CurrentDomain.Evidence;

        // Create appdomain
        AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);

        // Write out application domain information
        Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
        Console.WriteLine("child domain: " + domain.FriendlyName);
        Console.WriteLine("child domain name using ToString:" + domain.ToString());
        Console.WriteLine();
        
        AppDomain.Unload(domain);
    
    }
    
}

[C++] 
#using <mscorlib.dll>

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

int main() {
   // Create application domain setup information
   AppDomainSetup* domaininfo = new AppDomainSetup();

   //Create evidence for the new appdomain from evidence of the current application domain
   Evidence* adevidence = AppDomain::CurrentDomain->Evidence;

   // Create appdomain
   AppDomain*  domain = AppDomain::CreateDomain(S"MyDomain", adevidence, domaininfo);

   // Write out application domain information
   Console::WriteLine(S"Host domain: {0}", AppDomain::CurrentDomain->FriendlyName);
   Console::WriteLine(S"child domain: {0}", domain->FriendlyName);
   Console::WriteLine(S"child domain name using ToString: {0}", domain);
   Console::WriteLine();

   AppDomain::Unload(domain);

}

[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.

Requirements

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

Show:
© 2014 Microsoft