次の方法で共有


AppDomain.ToString メソッド

現在のインスタンスの String 形式を取得します。

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

戻り値

アプリケーション ドメインの表示名。

実装

_AppDomain.ToString

解説

返される文字列形式は、アプリケーション ドメインの表示名を示します。

使用例

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

AppDomain クラス | AppDomain メンバ | System 名前空間