Show / Hide Table of Contents

Struct KeyBytes

Wraps a byte array and provides equality comparison and hash code calculation. Designed to be used as a key in dictionaries.

Implements
IEquatable<KeyBytes>
Namespace: Libplanet.Store.Trie
Assembly: Libplanet.Store.dll
Syntax
public readonly struct KeyBytes

Constructors

| Improve this Doc View Source

KeyBytes(in ImmutableArray<Byte>)

Creates a new KeyBytes instance from the given byte array.

Declaration
public KeyBytes(in ImmutableArray<byte> bytes)
Parameters
Type Name Description
ImmutableArray<System.Byte> bytes

An immutable byte array to wrap.

| Improve this Doc View Source

KeyBytes(Byte[])

Creates a new KeyBytes instance from the given byte array.

Declaration
public KeyBytes(params byte[] bytes)
Parameters
Type Name Description
System.Byte[] bytes

A mutable byte array to wrap.

| Improve this Doc View Source

KeyBytes(String)

Creates a new KeyBytes instance from given str with Encoding.

Declaration
public KeyBytes(string str)
Parameters
Type Name Description
System.String str

The key langword_csharp_string to encode into bytes.

Fields

| Improve this Doc View Source

Encoding

The default , which is , to use when creating an instance from a langword_csharp_string.

Declaration
public static readonly Encoding Encoding
Field Value
Type Description
Encoding

Properties

| Improve this Doc View Source

ByteArray

The immutable array of bytes.

Declaration
public readonly ImmutableArray<byte> ByteArray { get; }
Property Value
Type Description
ImmutableArray<System.Byte>
| Improve this Doc View Source

Hex

The hexadecimal string representation of the byte array.

Declaration
public readonly string Hex { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Length

The length of the byte array.

Declaration
public readonly int Length { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Equals(KeyBytes)

Wraps a byte array and provides equality comparison and hash code calculation. Designed to be used as a key in dictionaries.

Declaration
public readonly bool Equals(KeyBytes other)
Parameters
Type Name Description
KeyBytes other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Nullable<Object>)

Wraps a byte array and provides equality comparison and hash code calculation. Designed to be used as a key in dictionaries.

Declaration
public override readonly bool Equals(object? obj)
Parameters
Type Name Description
System.Nullable<System.Object> obj
Returns
Type Description
System.Boolean
| Improve this Doc View Source

FromHex(String)

Parses the given hexadecimal string as bytes and returns a new KeyBytes instance.

Declaration
public static KeyBytes FromHex(string hex)
Parameters
Type Name Description
System.String hex

A hexadecimal string which encodes bytes.

Returns
Type Description
KeyBytes

A new KeyBytes instance.

| Improve this Doc View Source

GetHashCode()

Wraps a byte array and provides equality comparison and hash code calculation. Designed to be used as a key in dictionaries.

Declaration
public override readonly int GetHashCode()
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToByteArray()

Converts to a mutable byte array.

Declaration
public readonly byte[] ToByteArray()
Returns
Type Description
System.Byte[]

A new copy of mutable byte array.

| Improve this Doc View Source

ToString()

Wraps a byte array and provides equality comparison and hash code calculation. Designed to be used as a key in dictionaries.

Declaration
public override readonly string ToString()
Returns
Type Description
System.String

Operators

| Improve this Doc View Source

Equality(KeyBytes, KeyBytes)

Compares two KeyBytes values.

Declaration
public static bool operator ==(KeyBytes left, KeyBytes right)
Parameters
Type Name Description
KeyBytes left

An operand.

KeyBytes right

Another operand.

Returns
Type Description
System.Boolean

true if two values equal; otherwise false.

| Improve this Doc View Source

Inequality(KeyBytes, KeyBytes)

Compares two KeyBytes values.

Declaration
public static bool operator !=(KeyBytes left, KeyBytes right)
Parameters
Type Name Description
KeyBytes left

An operand.

KeyBytes right

Another operand.

Returns
Type Description
System.Boolean

false if two values equal; otherwise true.

Implements

IEquatable<>

Extension Methods

KeyBytesExtensions.ToByteString(KeyBytes)
KeyBytesExtensions.ToKeyValueStoreKey(KeyBytes)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium