Commit 1a25068a authored by Nick Craver's avatar Nick Craver

Cleanup: HashEntry

parent 0c87e944
...@@ -12,13 +12,16 @@ public struct HashEntry : IEquatable<HashEntry> ...@@ -12,13 +12,16 @@ public struct HashEntry : IEquatable<HashEntry>
internal readonly RedisValue name, value; internal readonly RedisValue name, value;
/// <summary> /// <summary>
/// Initializes a HashEntry value /// Initializes a <see cref="HashEntry"/> value.
/// </summary> /// </summary>
/// <param name="name">The name for this hash entry.</param>
/// <param name="value">The value for this hash entry.</param>
public HashEntry(RedisValue name, RedisValue value) public HashEntry(RedisValue name, RedisValue value)
{ {
this.name = name; this.name = name;
this.value = value; this.value = value;
} }
/// <summary> /// <summary>
/// The name of the hash field /// The name of the hash field
/// </summary> /// </summary>
...@@ -39,60 +42,51 @@ public HashEntry(RedisValue name, RedisValue value) ...@@ -39,60 +42,51 @@ public HashEntry(RedisValue name, RedisValue value)
/// <summary> /// <summary>
/// Converts to a key/value pair /// Converts to a key/value pair
/// </summary> /// </summary>
public static implicit operator KeyValuePair<RedisValue, RedisValue>(HashEntry value) /// <param name="value">The <see cref="HashEntry"/> to create a <see cref="KeyValuePair{TKey, TValue}"/> from.</param>
{ public static implicit operator KeyValuePair<RedisValue, RedisValue>(HashEntry value) =>
return new KeyValuePair<RedisValue, RedisValue>(value.name, value.value); new KeyValuePair<RedisValue, RedisValue>(value.name, value.value);
}
/// <summary> /// <summary>
/// Converts from a key/value pair /// Converts from a key/value pair
/// </summary> /// </summary>
public static implicit operator HashEntry(KeyValuePair<RedisValue, RedisValue> value) /// <param name="value">The <see cref="KeyValuePair{TKey, TValue}"/> to get a <see cref="HashEntry"/> from.</param>
{ public static implicit operator HashEntry(KeyValuePair<RedisValue, RedisValue> value) =>
return new HashEntry(value.Key, value.Value); new HashEntry(value.Key, value.Value);
}
/// <summary> /// <summary>
/// See Object.ToString() /// See Object.ToString()
/// </summary> /// </summary>
public override string ToString() public override string ToString() => name + ": " + value;
{
return name + ": " + value;
}
/// <summary> /// <summary>
/// See Object.GetHashCode() /// See Object.GetHashCode()
/// </summary> /// </summary>
public override int GetHashCode() public override int GetHashCode() => name.GetHashCode() ^ value.GetHashCode();
{
return name.GetHashCode() ^ value.GetHashCode();
}
/// <summary> /// <summary>
/// Compares two values for equality /// Compares two values for equality.
/// </summary> /// </summary>
public override bool Equals(object obj) /// <param name="obj">The <see cref="HashEntry"/> to compare to.</param>
{ public override bool Equals(object obj) => obj is HashEntry heObj && Equals(heObj);
return obj is HashEntry && Equals((HashEntry)obj);
}
/// <summary> /// <summary>
/// Compares two values for equality /// Compares two values for equality.
/// </summary> /// </summary>
public bool Equals(HashEntry other) /// <param name="other">The <see cref="HashEntry"/> to compare to.</param>
{ public bool Equals(HashEntry other) => name == other.name && value == other.value;
return name == other.name && this.value == other.value;
}
/// <summary> /// <summary>
/// Compares two values for equality /// Compares two values for equality
/// </summary> /// </summary>
public static bool operator ==(HashEntry x, HashEntry y) /// <param name="x">The first <see cref="HashEntry"/> to compare.</param>
{ /// <param name="y">The second <see cref="HashEntry"/> to compare.</param>
return x.name == y.name && x.value == y.value; public static bool operator ==(HashEntry x, HashEntry y) => x.name == y.name && x.value == y.value;
}
/// <summary> /// <summary>
/// Compares two values for non-equality /// Compares two values for non-equality
/// </summary> /// </summary>
public static bool operator !=(HashEntry x, HashEntry y) /// <param name="x">The first <see cref="HashEntry"/> to compare.</param>
{ /// <param name="y">The second <see cref="HashEntry"/> to compare.</param>
return x.name != y.name || x.value != y.value; public static bool operator !=(HashEntry x, HashEntry y) => x.name != y.name || x.value != y.value;
}
} }
} }
...@@ -11,6 +11,7 @@ public sealed class HashSlotMovedEventArgs : EventArgs, ICompletable ...@@ -11,6 +11,7 @@ public sealed class HashSlotMovedEventArgs : EventArgs, ICompletable
{ {
private readonly object sender; private readonly object sender;
private readonly EventHandler<HashSlotMovedEventArgs> handler; private readonly EventHandler<HashSlotMovedEventArgs> handler;
/// <summary> /// <summary>
/// The hash-slot that was relocated /// The hash-slot that was relocated
/// </summary> /// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment