System.Uri.GetParts C# (CSharp) Method

GetParts() private method

private GetParts ( UriComponents uriParts, UriFormat formatAs ) : string
uriParts UriComponents
formatAs UriFormat
return string
        internal string GetParts(UriComponents uriParts, UriFormat formatAs)
        {
            return GetComponents(uriParts, formatAs);
        }

Usage Example

Example #1
0
        //
        // This is for languages that do not support == != operators overloading
        //
        // Note that Uri.Equals will get an optimized path but is limited to true/fasle result only
        //
        public static int Compare(Uri uri1, Uri uri2, UriComponents partsToCompare, UriFormat compareFormat,
                                  StringComparison comparisonType)
        {
            if ((object)uri1 == null)
            {
                if (uri2 == null)
                {
                    return(0); // Equal
                }
                return(-1);    // null < non-null
            }
            if ((object)uri2 == null)
            {
                return(1);     // non-null > null
            }
            // a relative uri is always less than an absolute one
            if (!uri1.IsAbsoluteUri || !uri2.IsAbsoluteUri)
            {
                return(uri1.IsAbsoluteUri ? 1 : uri2.IsAbsoluteUri ? -1 : string.Compare(uri1.OriginalString,
                                                                                         uri2.OriginalString, comparisonType));
            }

            return(string.Compare(
                       uri1.GetParts(partsToCompare, compareFormat),
                       uri2.GetParts(partsToCompare, compareFormat),
                       comparisonType
                       ));
        }
All Usage Examples Of System.Uri::GetParts