Struct Priority
- Namespace
- AngleSharp.Css
- Assembly
- AngleSharp.dll
A priority object for comparing priorities.
public readonly struct Priority : IEquatable<Priority>, IComparable<Priority>
- Implements
- Inherited Members
- Extension Methods
Constructors
Priority(byte, byte, byte, byte)
Creates a new priority with the given values.
public Priority(byte inlines, byte ids, byte classes, byte tags)
Parameters
inlines
byteThe number of inlines.
ids
byteThe number of ids.
classes
byteThe number of classes.
tags
byteThe number of tags.
Priority(uint)
Creates a new priority with the given hashcode.
public Priority(uint priority)
Parameters
priority
uintThe hashcode to use.
Fields
Inline
Gets the priority for having an inline element.
public static readonly Priority Inline
Field Value
OneClass
Gets the priority for having a single class.
public static readonly Priority OneClass
Field Value
OneId
Gets the priority for having a single Id.
public static readonly Priority OneId
Field Value
OneTag
Gets the priority for having a single tag.
public static readonly Priority OneTag
Field Value
Zero
Gets the lowest (zero) priority.
public static readonly Priority Zero
Field Value
Properties
Classes
Gets the number of classes for this priority.
public byte Classes { get; }
Property Value
Ids
Gets the number of ids for this priority.
public byte Ids { get; }
Property Value
Inlines
Gets the number of inlines for this priority.
public byte Inlines { get; }
Property Value
Tags
Gets the number of tags for this priority.
public byte Tags { get; }
Property Value
Methods
CompareTo(Priority)
Compares the current priority with another priority.
public int CompareTo(Priority other)
Parameters
other
PriorityThe priority to compare to.
Returns
- int
A value greater than 1 if the current priority is larger.
Equals(Priority)
Checks two priorities for equality.
public bool Equals(Priority other)
Parameters
other
PriorityThe other priority.
Returns
- bool
True if both priorities or equal, otherwise false.
Equals(object?)
Tests if another object is equal to this object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to test with.
Returns
- bool
True if the two objects are equal, otherwise false.
GetHashCode()
Returns a hash code that defines the current priority.
public override int GetHashCode()
Returns
- int
The integer value of the hashcode.
ToString()
Returns a string representing the priority.
public override string ToString()
Returns
- string
The string representation.
Operators
operator +(Priority, Priority)
Adds the two given priorities.
public static Priority operator +(Priority a, Priority b)
Parameters
Returns
- Priority
The result of adding the two priorities.
operator ==(Priority, Priority)
Compares two priorities and returns a boolean indicating if the two do match.
public static bool operator ==(Priority a, Priority b)
Parameters
Returns
- bool
True if both priorities are equal, otherwise false.
operator >(Priority, Priority)
Compares two priorities and returns a boolean indicating if the first one is greater.
public static bool operator >(Priority a, Priority b)
Parameters
Returns
- bool
True if the first priority is higher, otherwise false.
operator >=(Priority, Priority)
Compares two priorities and returns a boolean indicating if the first one is greater or equal.
public static bool operator >=(Priority a, Priority b)
Parameters
Returns
- bool
True if the first priority is higher or equal, otherwise false.
operator !=(Priority, Priority)
Compares two priorities and returns a boolean indicating if the two do not match.
public static bool operator !=(Priority a, Priority b)
Parameters
Returns
- bool
True if both priorities are not equal, otherwise false.
operator <(Priority, Priority)
Compares two priorities and returns a boolean indicating if the second one is greater.
public static bool operator <(Priority a, Priority b)
Parameters
Returns
- bool
True if the second priority is higher, otherwise false.
operator <=(Priority, Priority)
Compares two priorities and returns a boolean indicating if the second one is greater or equal.
public static bool operator <=(Priority a, Priority b)
Parameters
Returns
- bool
True if the second priority is higher or equal, otherwise false.