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
07612d9a
Commit
07612d9a
authored
Aug 01, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RedisValue.TryParse: use pattern matching
parent
9dec0d82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
RedisValue.cs
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
+15
-13
No files found.
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
View file @
07612d9a
...
...
@@ -417,19 +417,21 @@ int IComparable.CompareTo(object obj)
internal
static
RedisValue
TryParse
(
object
obj
)
{
if
(
obj
==
null
)
return
RedisValue
.
Null
;
if
(
obj
is
RedisValue
)
return
(
RedisValue
)
obj
;
if
(
obj
is
string
)
return
(
RedisValue
)(
string
)
obj
;
if
(
obj
is
int
)
return
(
RedisValue
)(
int
)
obj
;
if
(
obj
is
double
)
return
(
RedisValue
)(
double
)
obj
;
if
(
obj
is
byte
[])
return
(
RedisValue
)(
byte
[])
obj
;
if
(
obj
is
bool
)
return
(
RedisValue
)(
bool
)
obj
;
if
(
obj
is
long
)
return
(
RedisValue
)(
long
)
obj
;
if
(
obj
is
float
)
return
(
RedisValue
)(
float
)
obj
;
if
(
obj
is
ReadOnlyMemory
<
byte
>)
return
(
RedisValue
)(
ReadOnlyMemory
<
byte
>)
obj
;
if
(
obj
is
Memory
<
byte
>)
return
(
RedisValue
)(
Memory
<
byte
>)
obj
;
return
Null
;
switch
(
obj
)
{
case
null
:
return
Null
;
case
RedisValue
v
:
return
v
;
case
string
v
:
return
v
;
case
int
v
:
return
v
;
case
double
v
:
return
v
;
case
byte
[]
v
:
return
v
;
case
bool
v
:
return
v
;
case
long
v
:
return
v
;
case
float
v
:
return
v
;
case
ReadOnlyMemory
<
byte
>
v
:
return
v
;
case
Memory
<
byte
>
v
:
return
v
;
default
:
return
Null
;
}
}
/// <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