AppDomainInfo.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Administration / AppDomainInfo.cs / 1 / AppDomainInfo.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel.Administration 
{
    using System; 
    using System.Diagnostics; 
    using System.Runtime.Serialization;
 
    internal sealed class AppDomainInfo
    {
        static object syncRoot = new object();
        static AppDomainInfo singleton; 
        Guid instanceId;
        string friendlyName; 
        bool isDefaultAppDomain; 
        string processName;
        string machineName; 
        int processId;
        int id;

        AppDomainInfo(AppDomain appDomain) 
        {
            // Assumption: Only one AppDomainInfo is created per AppDomain 
            DiagnosticUtility.DebugAssert(null != appDomain, ""); 
            this.instanceId = Guid.NewGuid();
            this.friendlyName = appDomain.FriendlyName; 
            this.isDefaultAppDomain = appDomain.IsDefaultAppDomain();
            Process process = Process.GetCurrentProcess();
            this.processName = process.ProcessName;
            this.machineName = Environment.MachineName; 
            this.processId = process.Id;
            this.id = appDomain.Id; 
 
        }
 
        public int Id
        {
            get
            { 
                return this.id;
            } 
        } 

        public Guid InstanceId 
        {
            get
            {
                return this.instanceId; 
            }
        } 
 
        public string MachineName
        { 
            get
            {
                return this.machineName;
            } 
        }
 
        public string Name 
        {
            get 
            {
                return this.friendlyName;
            }
        } 

        public bool IsDefaultAppDomain 
        { 
            get
            { 
                return this.isDefaultAppDomain;
            }
        }
 
        public int ProcessId
        { 
            get 
            {
                return this.processId; 
            }
        }

        public string ProcessName 
        {
            get 
            { 
                return this.processName;
            } 
        }

        internal static AppDomainInfo Current
        { 
            get
            { 
                if (null == singleton) 
                {
                    lock (AppDomainInfo.syncRoot) 
                    {
                        if (null == singleton)
                        {
                            singleton = new AppDomainInfo(AppDomain.CurrentDomain); 
                        }
                    } 
                } 
                return singleton;
            } 
        }
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK