/// <summary>
        /// Initializes a new instance of the <see cref="MediaTypeMatch"/> class.
        /// </summary>
        /// <param name="mediaType">The media type that has matched.  A <c>null</c> value is allowed.</param>
        /// <param name="quality">The quality of the match.</param>
        public MediaTypeMatch(MediaTypeHeaderValue mediaType, double quality)
        {
            Contract.Assert(quality >= 0 && quality <= 1.0, "Quality must be from 0.0 to 1.0, inclusive.");

            // We always clone the media type because it is mutable and we do not want the original source modified.
            MediaType = mediaType == null ? null : mediaType.Clone();
            Quality = quality;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaTypeFormatterMatch"/> class.
        /// </summary>
        /// <param name="formatter">The matching formatter.</param>
        /// <param name="mediaType">The media type. Can be <c>null</c> in which case the media type <c>application/octet-stream</c> is used.</param>
        /// <param name="quality">The quality of the match. Can be <c>null</c> in which case it is considered a full match with a value of 1.0</param>
        /// <param name="ranking">The kind of match.</param>
        public MediaTypeFormatterMatch(MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, double? quality, MediaTypeFormatterMatchRanking ranking)
        {
            if (formatter == null)
            {
                throw Error.ArgumentNull("formatter");
            }

            this.Formatter = formatter;
            this.MediaType = mediaType != null ? mediaType.Clone() : MediaTypeConstants.ApplicationOctetStreamMediaType;
            this.Quality = quality ?? FormattingUtilities.Match;
            this.Ranking = ranking;
        }