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
e1b8c936
Commit
e1b8c936
authored
Sep 19, 2015
by
Jeremy Meng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace Array.ConvertAll usage with Linq Select().ToArray().
parent
e734ab0a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
519 additions
and
517 deletions
+519
-517
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+1
-1
ExtensionMethods.cs
StackExchange.Redis/StackExchange/Redis/ExtensionMethods.cs
+127
-126
RedisResult.cs
StackExchange.Redis/StackExchange/Redis/RedisResult.cs
+391
-390
No files found.
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
e1b8c936
...
@@ -482,7 +482,7 @@ public EndPoint[] GetEndPoints(bool configuredOnly = false)
...
@@ -482,7 +482,7 @@ public EndPoint[] GetEndPoints(bool configuredOnly = false)
{
{
if
(
configuredOnly
)
return
configuration
.
EndPoints
.
ToArray
();
if
(
configuredOnly
)
return
configuration
.
EndPoints
.
ToArray
();
return
Array
.
ConvertAll
(
serverSnapshot
,
x
=>
x
.
EndPoint
);
return
serverSnapshot
.
Select
(
x
=>
x
.
EndPoint
).
ToArray
(
);
}
}
private
readonly
int
timeoutMilliseconds
;
private
readonly
int
timeoutMilliseconds
;
...
...
StackExchange.Redis/StackExchange/Redis/ExtensionMethods.cs
View file @
e1b8c936
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
...
@@ -120,7 +121,7 @@ public static string[] ToStringArray(this RedisValue[] values)
...
@@ -120,7 +121,7 @@ public static string[] ToStringArray(this RedisValue[] values)
{
{
if
(
values
==
null
)
return
null
;
if
(
values
==
null
)
return
null
;
if
(
values
.
Length
==
0
)
return
nix
;
if
(
values
.
Length
==
0
)
return
nix
;
return
Array
.
ConvertAll
(
values
,
x
=>
(
string
)
x
);
return
values
.
Select
(
x
=>
(
string
)
x
).
ToArray
();
}
}
}
}
}
}
StackExchange.Redis/StackExchange/Redis/RedisResult.cs
View file @
e1b8c936
using
System
;
using
System
;
using
System.Linq
;
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
...
@@ -194,14 +195,14 @@ internal override bool AsBoolean()
...
@@ -194,14 +195,14 @@ internal override bool AsBoolean()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
bool
[]
AsBooleanArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsBoolean
());
}
internal
override
bool
[]
AsBooleanArray
()
{
return
value
.
Select
(
x
=>
x
.
AsBoolean
()).
ToArray
();
}
internal
override
byte
[]
AsByteArray
()
internal
override
byte
[]
AsByteArray
()
{
{
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsByteArray
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsByteArray
();
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
byte
[][]
AsByteArrayArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsByteArray
());
}
internal
override
byte
[][]
AsByteArrayArray
()
{
return
value
.
Select
(
x
=>
x
.
AsByteArray
()).
ToArray
();
}
internal
override
double
AsDouble
()
internal
override
double
AsDouble
()
{
{
...
@@ -209,7 +210,7 @@ internal override double AsDouble()
...
@@ -209,7 +210,7 @@ internal override double AsDouble()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
double
[]
AsDoubleArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsDouble
());
}
internal
override
double
[]
AsDoubleArray
()
{
return
value
.
Select
(
x
=>
x
.
AsDouble
()).
ToArray
();
}
internal
override
int
AsInt32
()
internal
override
int
AsInt32
()
{
{
...
@@ -217,7 +218,7 @@ internal override int AsInt32()
...
@@ -217,7 +218,7 @@ internal override int AsInt32()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
int
[]
AsInt32Array
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsInt32
());
}
internal
override
int
[]
AsInt32Array
()
{
return
value
.
Select
(
x
=>
x
.
AsInt32
()).
ToArray
();
}
internal
override
long
AsInt64
()
internal
override
long
AsInt64
()
{
{
...
@@ -225,7 +226,7 @@ internal override long AsInt64()
...
@@ -225,7 +226,7 @@ internal override long AsInt64()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
long
[]
AsInt64Array
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsInt64
());
}
internal
override
long
[]
AsInt64Array
()
{
return
value
.
Select
(
x
=>
x
.
AsInt64
()).
ToArray
();
}
internal
override
bool
?
AsNullableBoolean
()
internal
override
bool
?
AsNullableBoolean
()
{
{
...
@@ -257,7 +258,7 @@ internal override RedisKey AsRedisKey()
...
@@ -257,7 +258,7 @@ internal override RedisKey AsRedisKey()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsRedisKey
());
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
return
value
.
Select
(
x
=>
x
.
AsRedisKey
()).
ToArray
();
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
return
value
;
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
return
value
;
}
...
@@ -267,14 +268,14 @@ internal override RedisValue AsRedisValue()
...
@@ -267,14 +268,14 @@ internal override RedisValue AsRedisValue()
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsRedisValue
());
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
return
value
.
Select
(
x
=>
x
.
AsRedisValue
()).
ToArray
();
}
internal
override
string
AsString
()
internal
override
string
AsString
()
{
{
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsString
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsString
();
throw
new
InvalidCastException
();
throw
new
InvalidCastException
();
}
}
internal
override
string
[]
AsStringArray
()
{
return
Array
.
ConvertAll
(
value
,
x
=>
x
.
AsString
());
}
internal
override
string
[]
AsStringArray
()
{
return
value
.
Select
(
x
=>
x
.
AsString
()).
ToArray
();
}
}
}
private
sealed
class
ErrorRedisResult
:
RedisResult
private
sealed
class
ErrorRedisResult
:
RedisResult
...
...
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