Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
1a25068a
Commit
1a25068a
authored
Mar 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: HashEntry
parent
0c87e944
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
35 deletions
+30
-35
HashEntry.cs
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
+29
-35
HashSlotMovedEventArgs.cs
...hange.Redis/StackExchange/Redis/HashSlotMovedEventArgs.cs
+1
-0
No files found.
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
View file @
1a25068a
...
...
@@ -12,13 +12,16 @@ public struct HashEntry : IEquatable<HashEntry>
internal
readonly
RedisValue
name
,
value
;
/// <summary>
/// Initializes a
HashEntry value
/// Initializes a
<see cref="HashEntry"/> value.
/// </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
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
/// <summary>
/// The name of the hash field
/// </summary>
...
...
@@ -39,60 +42,51 @@ public HashEntry(RedisValue name, RedisValue value)
/// <summary>
/// Converts to a key/value pair
/// </summary>
public
static
implicit
operator
KeyValuePair
<
RedisValue
,
RedisValue
>(
HashEntry
value
)
{
return
new
KeyValuePair
<
RedisValue
,
RedisValue
>(
value
.
name
,
value
.
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
)
=>
new
KeyValuePair
<
RedisValue
,
RedisValue
>(
value
.
name
,
value
.
value
);
/// <summary>
/// Converts from a key/value pair
/// </summary>
public
static
implicit
operator
HashEntry
(
KeyValuePair
<
RedisValue
,
RedisValue
>
value
)
{
return
new
HashEntry
(
value
.
Key
,
value
.
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
)
=>
new
HashEntry
(
value
.
Key
,
value
.
Value
);
/// <summary>
/// See Object.ToString()
/// </summary>
public
override
string
ToString
()
{
return
name
+
": "
+
value
;
}
public
override
string
ToString
()
=>
name
+
": "
+
value
;
/// <summary>
/// See Object.GetHashCode()
/// </summary>
public
override
int
GetHashCode
()
{
return
name
.
GetHashCode
()
^
value
.
GetHashCode
();
}
public
override
int
GetHashCode
()
=>
name
.
GetHashCode
()
^
value
.
GetHashCode
();
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
.
/// </summary>
public
override
bool
Equals
(
object
obj
)
{
return
obj
is
HashEntry
&&
Equals
((
HashEntry
)
obj
);
}
/// <param name="obj">The <see cref="HashEntry"/> to compare to.</param>
public
override
bool
Equals
(
object
obj
)
=>
obj
is
HashEntry
heObj
&&
Equals
(
heObj
);
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
.
/// </summary>
public
bool
Equals
(
HashEntry
other
)
{
return
name
==
other
.
name
&&
this
.
value
==
other
.
value
;
}
/// <param name="other">The <see cref="HashEntry"/> to compare to.</param>
public
bool
Equals
(
HashEntry
other
)
=>
name
==
other
.
name
&&
value
==
other
.
value
;
/// <summary>
/// Compares two values for equality
/// </summary>
public
static
bool
operator
==(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
==
y
.
name
&&
x
.
value
==
y
.
value
;
}
/// <param name="x">The first <see cref="HashEntry"/> to compare.</param>
/// <param name="y">The second <see cref="HashEntry"/> to compare.</param>
public
static
bool
operator
==(
HashEntry
x
,
HashEntry
y
)
=>
x
.
name
==
y
.
name
&&
x
.
value
==
y
.
value
;
/// <summary>
/// Compares two values for non-equality
/// </summary>
public
static
bool
operator
!=(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
!=
y
.
name
||
x
.
value
!=
y
.
value
;
}
/// <param name="x">The first <see cref="HashEntry"/> to compare.</param>
/// <param name="y">The second <see cref="HashEntry"/> to compare.</param>
public
static
bool
operator
!=(
HashEntry
x
,
HashEntry
y
)
=>
x
.
name
!=
y
.
name
||
x
.
value
!=
y
.
value
;
}
}
StackExchange.Redis/StackExchange/Redis/HashSlotMovedEventArgs.cs
View file @
1a25068a
...
...
@@ -11,6 +11,7 @@ public sealed class HashSlotMovedEventArgs : EventArgs, ICompletable
{
private
readonly
object
sender
;
private
readonly
EventHandler
<
HashSlotMovedEventArgs
>
handler
;
/// <summary>
/// The hash-slot that was relocated
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment