StringWithQualityHeaderValueComparer Class¶
Implementation of System.Collections.Generic.IComparer`1
that can compare content negotiation header fields
based on their quality values (a.k.a q-values). This applies to values used in accept-charset,
accept-encoding, accept-language and related header fields with similar syntax rules. See
Microsoft.Net.Http.Headers.MediaTypeHeaderValueComparer
for a comparer for media type
q-values.
- Namespace
Microsoft.Net.Http.Headers
- Assemblies
- Microsoft.Net.Http.Headers
Syntax¶
public class StringWithQualityHeaderValueComparer : IComparer<StringWithQualityHeaderValue>
-
class
Microsoft.Net.Http.Headers.
StringWithQualityHeaderValueComparer
Methods¶
-
Compare
(Microsoft.Net.Http.Headers.StringWithQualityHeaderValue, Microsoft.Net.Http.Headers.StringWithQualityHeaderValue)¶ Compares two
Microsoft.Net.Http.Headers.StringWithQualityHeaderValue
based on their quality value (a.k.a their “q-value”). Values with identical q-values are considered equal (i.e the result is 0) with the exception of wild-card values (i.e. a value of “*”) which are considered less than non-wild-card values. This allows to sort a sequence ofMicrosoft.Net.Http.Headers.StringWithQualityHeaderValue
following their q-values ending up with any wild-cards at the end.Arguments: - stringWithQuality1 (Microsoft.Net.Http.Headers.StringWithQualityHeaderValue) – The first value to compare.
- stringWithQuality2 (Microsoft.Net.Http.Headers.StringWithQualityHeaderValue) – The second value to compare
Return type: System.Int32
Returns: The result of the comparison.
public int Compare(StringWithQualityHeaderValue stringWithQuality1, StringWithQualityHeaderValue stringWithQuality2)
-
Properties¶
-
Microsoft.Net.Http.Headers.StringWithQualityHeaderValueComparer.
QualityComparer
¶ Return type: Microsoft.Net.Http.Headers.StringWithQualityHeaderValueComparer public static StringWithQualityHeaderValueComparer QualityComparer { get; }
-