/// <summary>
        /// Overriding Equals
        /// </summary>
        /// <param name="obj">Object to compare with own instance.</param>
        /// <returns>Return true if the segment start / end values match.</returns>
        public override bool Equals(object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }
            // If parameter cannot be cast to Point return false.
            TerminalSessionInfo p = (TerminalSessionInfo)obj;

            if ((System.Object)p == null)
            {
                return(false);
            }

            // Return true if the segment start / end values match:
            return(Equals(this, p));
        }
        /// <summary>
        /// Memberwise comparison
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        public static bool Equals(TerminalSessionInfo a, TerminalSessionInfo b)
        {
            bool retval = false;

            if (((System.Object)a == null) && (System.Object)b == null)
            {
                return(false);
            }
            if (((System.Object)a == null) ^ (System.Object)b == null)
            {
                return(false);
            }

            // check property members
            string[] properties = new string[] {
                "UserName",
                "Domain",
                "ClientIPAddress",
                "ClientMachineName",
                "SessionInfo.iSessionID",
                "SessionInfo.sWinsWorkstationName",
                "SessionInfo.oState",
                "ProtocolType",
                "ClientInfo.ClientMachineName",
                "ClientInfo.Domain",
                "ClientInfo.UserName",
                "ClientInfo.WorkDirectory",
                "ClientInfo.InitialProgram",
                "ClientInfo.EncryptionLevel",
                "ClientInfo.ClientAddressFamily",
                "ClientInfo.ClientAddress",
                "ClientInfo.HRes",
                "ClientInfo.VRes",
                "ClientInfo.ColorDepth",
                "ClientInfo.ClientDirectory",
                "ClientInfo.ClientBuildNumber",
                "ClientInfo.ClientHardwareId",
                "ClientInfo.ClientProductId",
                "ClientInfo.DeviceId",
                "WtsInfo.State",
                "WtsInfo.SessionId",
                "WtsInfo.WinStationName",
                "WtsInfo.Domain",
                "WtsInfo.UserName",
                "WtsInfo.ConnectTime",
                "WtsInfo.DisconnectTime",
                "WtsInfo.LogonTime"
            };

            retval = true;
            object vala, valb;

            foreach (string prop in properties)
            {
                try {
                    vala = GetFieldItem(a, prop);
                    valb = GetFieldItem(b, prop);
                    if (((System.Object)vala == null) && (System.Object)valb == null)
                    {
                        continue;
                    }
                    if (((System.Object)vala == null) ^ (System.Object)valb == null)
                    {
                        return(false);
                    }

                    if (!Object.Equals(vala, valb))
                    {
                        return(false);
                    }
                }
                catch (Exception ex) {
                    retval = false;
                }
            }
            return(retval);
        }