Specificity Struct
The specificity of a selector (https://drafts.csswg.org/selectors-4/#specificity-rules).
public readonly struct Specificity : IComparable<Specificity>, IEquatable<Specificity>Constructors
| Name | Description |
|---|---|
| Specificity(int, int, int) | The specificity of a selector (https://drafts.csswg.org/selectors-4/#specificity-rules). |
Specificity(int, int, int)
Properties
| Name | Description |
|---|---|
| A | The number of ID selectors. |
| B | The number of class selectors, attribute selectors and pseudo-classes. |
| C | The number of type selectors and pseudo-elements. |
Methods
| Name | Description |
|---|---|
| CompareTo(Specificity) | Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. |
| Deconstruct(int, int, int) | |
| Equals(Specificity) | |
| Equals(object) | |
| GetHashCode() | |
| Max(Specificity, Specificity) | Returns the greater of the two specificities. |
| ToString() | Returns the specificity as "(A, B, C)". |
CompareTo(Specificity)
Selector.csCompares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(Specificity other)Parameters
otherSpecificity- An object to compare with this instance.
Returns
int A value that indicates the relative order of the objects being compared. The return value has these meanings:
| Value | Meaning |
|---|---|
| Less than zero | This instance precedes other in the sort order. |
| Zero | This instance occurs in the same position in the sort order as other. |
| Greater than zero | This instance follows other in the sort order. |
Deconstruct(int, int, int)
Equals overloads
Equals(Specificity)
public bool Equals(Specificity other)No documentation is available.
Equals(object)
GetHashCode()
Max(Specificity, Specificity)
Selector.csReturns the greater of the two specificities.
public static Specificity Max(Specificity left, Specificity right)ToString()
Selector.csOperators
| Name | Description |
|---|---|
| operator +(Specificity, Specificity) | Returns the component-wise sum of the two specificities. |
| operator ==(Specificity, Specificity) | |
| operator >(Specificity, Specificity) | Returns whether the left specificity is greater than the right specificity. |
| operator >=(Specificity, Specificity) | Returns whether the left specificity is greater than or equal to the right specificity. |
| operator !=(Specificity, Specificity) | |
| operator <(Specificity, Specificity) | Returns whether the left specificity is lower than the right specificity. |
| operator <=(Specificity, Specificity) | Returns whether the left specificity is lower than or equal to the right specificity. |
operator +(Specificity, Specificity)
Selector.csReturns the component-wise sum of the two specificities.
public static Specificity operator +(Specificity left, Specificity right)operator ==(Specificity, Specificity)
public static bool operator ==(Specificity left, Specificity right)No documentation is available.
operator >(Specificity, Specificity)
Selector.csReturns whether the left specificity is greater than the right specificity.
public static bool operator >(Specificity left, Specificity right)operator >=(Specificity, Specificity)
Selector.csReturns whether the left specificity is greater than or equal to the right specificity.
public static bool operator >=(Specificity left, Specificity right)operator !=(Specificity, Specificity)
public static bool operator !=(Specificity left, Specificity right)No documentation is available.
operator <(Specificity, Specificity)
Selector.csReturns whether the left specificity is lower than the right specificity.
public static bool operator <(Specificity left, Specificity right)operator <=(Specificity, Specificity)
Selector.csReturns whether the left specificity is lower than or equal to the right specificity.
public static bool operator <=(Specificity left, Specificity right)