/// <summary>Gets a number of non-* matching types, or -1 if not matching at all.</summary> /// <param name="candidate">Candidate MIME type to match.</param> /// <returns>The number of non-* matching types, or -1 if not matching at all.</returns> internal int GetMatchingParts(MediaType candidate) { Debug.Assert(candidate != null, "candidate must not be null."); int result = -1; if (candidate != null) { if (this.type == "*") { result = 0; } else { if (candidate.subType != null) { string candidateType = candidate.type; if (CompareMimeType(this.type, candidateType)) { if (this.subType == "*") { result = 1; } else { string candidateSubType = candidate.subType; if (CompareMimeType(this.subType, candidateSubType)) { if (String.Equals(this.GetParameterValue(XmlConstants.MimeODataParameterName), candidate.GetParameterValue(XmlConstants.MimeODataParameterName), StringComparison.OrdinalIgnoreCase)) { result = 2; } } } } } } } return result; }