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
Show 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)
...
@@ -417,19 +417,21 @@ int IComparable.CompareTo(object obj)
internal
static
RedisValue
TryParse
(
object
obj
)
internal
static
RedisValue
TryParse
(
object
obj
)
{
{
if
(
obj
==
null
)
return
RedisValue
.
Null
;
switch
(
obj
)
if
(
obj
is
RedisValue
)
return
(
RedisValue
)
obj
;
{
if
(
obj
is
string
)
return
(
RedisValue
)(
string
)
obj
;
case
null
:
return
Null
;
if
(
obj
is
int
)
return
(
RedisValue
)(
int
)
obj
;
case
RedisValue
v
:
return
v
;
if
(
obj
is
double
)
return
(
RedisValue
)(
double
)
obj
;
case
string
v
:
return
v
;
if
(
obj
is
byte
[])
return
(
RedisValue
)(
byte
[])
obj
;
case
int
v
:
return
v
;
if
(
obj
is
bool
)
return
(
RedisValue
)(
bool
)
obj
;
case
double
v
:
return
v
;
if
(
obj
is
long
)
return
(
RedisValue
)(
long
)
obj
;
case
byte
[]
v
:
return
v
;
if
(
obj
is
float
)
return
(
RedisValue
)(
float
)
obj
;
case
bool
v
:
return
v
;
if
(
obj
is
ReadOnlyMemory
<
byte
>)
return
(
RedisValue
)(
ReadOnlyMemory
<
byte
>)
obj
;
case
long
v
:
return
v
;
if
(
obj
is
Memory
<
byte
>)
return
(
RedisValue
)(
Memory
<
byte
>)
obj
;
case
float
v
:
return
v
;
case
ReadOnlyMemory
<
byte
>
v
:
return
v
;
return
Null
;
case
Memory
<
byte
>
v
:
return
v
;
default
:
return
Null
;
}
}
}
/// <summary>
/// <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