System.Net.ValidationHelper.ToString C# (CSharp) Method

ToString() public static method

public static ToString ( object objectValue ) : string
objectValue object
return string
        public static string ToString(object objectValue) {
            if (objectValue == null) {
                return "(null)";
            } else if (objectValue is string && ((string)objectValue).Length==0) {
                return "(string.empty)";
            } else if (objectValue is Exception) {
                return ExceptionMessage(objectValue as Exception);
            } else if (objectValue is IntPtr) {
                return "0x" + ((IntPtr)objectValue).ToString("x");
            } else {
                return objectValue.ToString();
            }
        }
        public static string HashString(object objectValue) {

Usage Example

Example #1
0
        public bool isResolvableEx(string host)
        {
            GlobalLog.Print("WebProxyScriptHelper::dnsResolveEx() host:" + ValidationHelper.ToString(host));
            if (host == null)
            {
                if (Logging.On)
                {
                    Logging.PrintWarning(Logging.Web, SR.GetString(SR.net_log_proxy_called_with_null_parameter, "WebProxyScriptHelper.dnsResolve()", "host"));
                }
                throw new ArgumentNullException("host");
            }
            IPHostEntry ipHostEntry = null;

            try
            {
                ipHostEntry = Dns.InternalGetHostByName(host);
            }
            catch { }
            if (ipHostEntry == null)
            {
                return(false);
            }
            IPAddress[] addresses = ipHostEntry.AddressList;
            if (addresses.Length == 0)
            {
                return(false);
            }
            return(true);
        }
All Usage Examples Of System.Net.ValidationHelper::ToString