Example #1
0
    /// <summary>
    /// Initializes a new instance of <see cref="StringWithQualityHeaderValue"/>.
    /// </summary>
    /// <param name="value">The <see cref="StringSegment"/> used to initialize the new instance.</param>
    /// <param name="quality">The quality factor.</param>
    public StringWithQualityHeaderValue(StringSegment value, double quality)
    {
        HeaderUtilities.CheckValidToken(value, nameof(value));

        if ((quality < 0) || (quality > 1))
        {
            throw new ArgumentOutOfRangeException(nameof(quality));
        }

        _value   = value;
        _quality = quality;
    }
    /// <summary>
    /// Initializes a new instance of <see cref="StringWithQualityHeaderValue"/>.
    /// </summary>
    /// <param name="value">The <see cref="StringSegment"/> used to initialize the new instance.</param>
    public StringWithQualityHeaderValue(StringSegment value)
    {
        HeaderUtilities.CheckValidToken(value, nameof(value));

        _value = value;
    }
 private static void CheckNameValueFormat(StringSegment name, StringSegment value)
 {
     HeaderUtilities.CheckValidToken(name, nameof(name));
     CheckValueFormat(value);
 }
Example #4
0
 private static void CheckIsValidToken(StringSegment item)
 {
     HeaderUtilities.CheckValidToken(item, nameof(item));
 }