Parse() private method

private Parse ( string identifier ) : Identifier
identifier string
return Identifier
Exemplo n.º 1
0
        /// <summary>
        /// Tests equality between this URI and another URI.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            UriIdentifier other = obj as UriIdentifier;

            if (obj != null && other == null && Identifier.EqualityOnStrings)               // test hook to enable MockIdentifier comparison
            {
                other = Identifier.Parse(obj.ToString()) as UriIdentifier;
            }
            if (other == null)
            {
                return(false);
            }
            return(this.Uri == other.Uri);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tests equality between this XRI and another XRI.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            XriIdentifier other = obj as XriIdentifier;

            if (obj != null && other == null && Identifier.EqualityOnStrings)               // test hook to enable MockIdentifier comparison
            {
                string objString = obj.ToString();
                ErrorUtilities.VerifyInternal(!string.IsNullOrEmpty(objString), "Identifier.ToString() returned a null or empty string.");
                other = Identifier.Parse(objString) as XriIdentifier;
            }
            if (other == null)
            {
                return(false);
            }
            return(this.CanonicalXri == other.CanonicalXri);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Tests equality between this URI and another URI.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            UriIdentifier other = obj as UriIdentifier;

            if (obj != null && other == null && Identifier.EqualityOnStrings)               // test hook to enable MockIdentifier comparison
            {
                other = Identifier.Parse(obj.ToString()) as UriIdentifier;
            }
            if (other == null)
            {
                return(false);
            }

            if (this.ProblematicNormalization || other.ProblematicNormalization)
            {
                return(new SimpleUri(this.OriginalString).Equals(new SimpleUri(other.OriginalString)));
            }
            else
            {
                return(this.Uri == other.Uri);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Decodes the specified value.
 /// </summary>
 /// <param name="value">The string value carried by the transport.  Guaranteed to never be null, although it may be empty.</param>
 /// <returns>The deserialized form of the given string.</returns>
 /// <exception cref="FormatException">Thrown when the string value given cannot be decoded into the required object type.</exception>
 public object Decode(string value)
 {
     Requires.NotNull(value, "value");
     ErrorUtilities.VerifyFormat(value.Length > 0, MessagingStrings.NonEmptyStringExpected);
     return(Identifier.Parse(value, true));
 }