Class BencodeStringComparer
Provides comparisons of bencode strings.
Inheritance
System.Object
BencodeStringComparer
Implements
System.Collections.Generic.IComparer<System.Byte[]>
System.Collections.Generic.IComparer<System.ReadOnlyMemory<System.Byte>>
System.Collections.Generic.IEqualityComparer<System.Byte[]>
System.Collections.Generic.IEqualityComparer<System.ReadOnlyMemory<System.Byte>>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ItsyBitsy.Bencoding
Assembly: ItsyBitsy.Bencoding.dll
Syntax
public sealed class BencodeStringComparer : IComparer<byte[]>, IComparer<ReadOnlyMemory<byte>>, IEqualityComparer<byte[]>, IEqualityComparer<ReadOnlyMemory<byte>>
Fields
| Improve this Doc View SourceInstance
Gets a shared instance of the comparer.
Declaration
public static readonly BencodeStringComparer Instance
Field Value
Type | Description |
---|---|
BencodeStringComparer |
Methods
| Improve this Doc View SourceCompare(Byte[], Byte[])
Compares two instances and returns a value indicating their relative values.
Declaration
public int Compare(byte[] x, byte[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | x | The first instance to compare. |
System.Byte[] | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A number indicating the relative values of x and
y . A negative number indicates that x is less
than y . A positive number indicates that x is
greater than y . Zero indicates that x is
equal to y . |
Compare(ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>)
Compares two instances and returns a value indicating their relative values.
Declaration
public int Compare(ReadOnlyMemory<byte> x, ReadOnlyMemory<byte> y)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | x | The first instance to compare. |
System.ReadOnlyMemory<System.Byte> | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A number indicating the relative values of x and
y . A negative number indicates that x is less
than y . A positive number indicates that x is
greater than y . Zero indicates that x is
equal to y . |
Compare(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)
Compares two instances and returns a value indicating their relative values.
Declaration
public static int Compare(ReadOnlySpan<byte> x, ReadOnlySpan<byte> y)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | x | The first instance to compare. |
System.ReadOnlySpan<System.Byte> | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A number indicating the relative values of x and
y . A negative number indicates that x is less
than y . A positive number indicates that x is
greater than y . Zero indicates that x is
equal to y . |
Equals(Byte[], Byte[])
Returns a value indicating whether two instance are equal.
Declaration
public bool Equals(byte[] x, byte[] y)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | x | The first instance to compare. |
System.Byte[] | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the two instances are equal; otherwise, false. |
Equals(ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>)
Returns a value indicating whether two instance are equal.
Declaration
public bool Equals(ReadOnlyMemory<byte> x, ReadOnlyMemory<byte> y)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | x | The first instance to compare. |
System.ReadOnlyMemory<System.Byte> | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the two instances are equal; otherwise, false. |
Equals(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)
Returns a value indicating whether two instance are equal.
Declaration
public static bool Equals(ReadOnlySpan<byte> x, ReadOnlySpan<byte> y)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | x | The first instance to compare. |
System.ReadOnlySpan<System.Byte> | y | The second instance to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the two instances are equal; otherwise, false. |
GetHashCode(Byte[])
Returns the hash code for an instance.
Declaration
public int GetHashCode(byte[] obj)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | obj | The instance to generate a hash code for. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCode(ReadOnlyMemory<Byte>)
Returns the hash code for an instance.
Declaration
public int GetHashCode(ReadOnlyMemory<byte> obj)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | obj | The instance to generate a hash code for. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCode(ReadOnlySpan<Byte>)
Returns the hash code for an instance.
Declaration
public static int GetHashCode(ReadOnlySpan<byte> span)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | span | The instance to generate a hash code for. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
Implements
System.Collections.Generic.IComparer<T>
System.Collections.Generic.IComparer<T>
System.Collections.Generic.IEqualityComparer<T>
System.Collections.Generic.IEqualityComparer<T>