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
437b7d58
Commit
437b7d58
authored
Sep 25, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add + as a concatenation operator for RedisKey, to prevent implicit conversions back and fore
parent
28e2d29b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
RedisKey.cs
StackExchange.Redis/StackExchange/Redis/RedisKey.cs
+20
-0
No files found.
StackExchange.Redis/StackExchange/Redis/RedisKey.cs
View file @
437b7d58
...
...
@@ -195,5 +195,25 @@ internal void AssertNotNull()
return
BitConverter
.
ToString
(
arr
);
}
}
/// <summary>
/// Concatenate two keys
/// </summary>
public
static
RedisKey
operator
+(
RedisKey
x
,
RedisKey
y
)
{
byte
[]
xVal
=
x
.
value
,
yVal
=
y
.
value
;
// either null? yeild the other; note this includes the "both null becomes null" case
if
(
xVal
==
null
)
return
y
;
if
(
yVal
==
null
)
return
x
;
// either empty? yeild the other; note this includes the "both null becomes null" case
if
(
xVal
.
Length
==
0
)
return
y
;
if
(
yVal
.
Length
==
0
)
return
x
;
byte
[]
result
=
new
byte
[
xVal
.
Length
+
yVal
.
Length
];
Buffer
.
BlockCopy
(
xVal
,
0
,
result
,
0
,
xVal
.
Length
);
Buffer
.
BlockCopy
(
yVal
,
0
,
result
,
xVal
.
Length
,
yVal
.
Length
);
return
result
;
}
}
}
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