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
Hide 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
/// <summary>
{
/// Utility methods
/// <summary>
/// </summary>
/// Utility methods
public
static
class
ExtensionMethods
/// </summary>
{
public
static
class
ExtensionMethods
/// <summary>
{
/// Create a dictionary from an array of HashEntry values
/// <summary>
/// </summary>
/// Create a dictionary from an array of HashEntry values
public
static
Dictionary
<
string
,
string
>
ToStringDictionary
(
this
HashEntry
[]
hash
)
/// </summary>
{
public
static
Dictionary
<
string
,
string
>
ToStringDictionary
(
this
HashEntry
[]
hash
)
if
(
hash
==
null
)
return
null
;
{
if
(
hash
==
null
)
return
null
;
var
result
=
new
Dictionary
<
string
,
string
>(
hash
.
Length
,
StringComparer
.
Ordinal
);
for
(
int
i
=
0
;
i
<
hash
.
Length
;
i
++)
var
result
=
new
Dictionary
<
string
,
string
>(
hash
.
Length
,
StringComparer
.
Ordinal
);
{
for
(
int
i
=
0
;
i
<
hash
.
Length
;
i
++)
result
.
Add
(
hash
[
i
].
name
,
hash
[
i
].
value
);
{
}
result
.
Add
(
hash
[
i
].
name
,
hash
[
i
].
value
);
return
result
;
}
}
return
result
;
/// <summary>
}
/// Create a dictionary from an array of HashEntry values
/// <summary>
/// </summary>
/// Create a dictionary from an array of HashEntry values
public
static
Dictionary
<
RedisValue
,
RedisValue
>
ToDictionary
(
this
HashEntry
[]
hash
)
/// </summary>
{
public
static
Dictionary
<
RedisValue
,
RedisValue
>
ToDictionary
(
this
HashEntry
[]
hash
)
if
(
hash
==
null
)
return
null
;
{
if
(
hash
==
null
)
return
null
;
var
result
=
new
Dictionary
<
RedisValue
,
RedisValue
>(
hash
.
Length
);
for
(
int
i
=
0
;
i
<
hash
.
Length
;
i
++)
var
result
=
new
Dictionary
<
RedisValue
,
RedisValue
>(
hash
.
Length
);
{
for
(
int
i
=
0
;
i
<
hash
.
Length
;
i
++)
result
.
Add
(
hash
[
i
].
name
,
hash
[
i
].
value
);
{
}
result
.
Add
(
hash
[
i
].
name
,
hash
[
i
].
value
);
return
result
;
}
}
return
result
;
}
/// <summary>
/// Create a dictionary from an array of SortedSetEntry values
/// <summary>
/// </summary>
/// Create a dictionary from an array of SortedSetEntry values
public
static
Dictionary
<
string
,
double
>
ToStringDictionary
(
this
SortedSetEntry
[]
sortedSet
)
/// </summary>
{
public
static
Dictionary
<
string
,
double
>
ToStringDictionary
(
this
SortedSetEntry
[]
sortedSet
)
if
(
sortedSet
==
null
)
return
null
;
{
if
(
sortedSet
==
null
)
return
null
;
var
result
=
new
Dictionary
<
string
,
double
>(
sortedSet
.
Length
,
StringComparer
.
Ordinal
);
for
(
int
i
=
0
;
i
<
sortedSet
.
Length
;
i
++)
var
result
=
new
Dictionary
<
string
,
double
>(
sortedSet
.
Length
,
StringComparer
.
Ordinal
);
{
for
(
int
i
=
0
;
i
<
sortedSet
.
Length
;
i
++)
result
.
Add
(
sortedSet
[
i
].
element
,
sortedSet
[
i
].
score
);
{
}
result
.
Add
(
sortedSet
[
i
].
element
,
sortedSet
[
i
].
score
);
return
result
;
}
}
return
result
;
}
/// <summary>
/// Create a dictionary from an array of SortedSetEntry values
/// <summary>
/// </summary>
/// Create a dictionary from an array of SortedSetEntry values
public
static
Dictionary
<
RedisValue
,
double
>
ToDictionary
(
this
SortedSetEntry
[]
sortedSet
)
/// </summary>
{
public
static
Dictionary
<
RedisValue
,
double
>
ToDictionary
(
this
SortedSetEntry
[]
sortedSet
)
if
(
sortedSet
==
null
)
return
null
;
{
if
(
sortedSet
==
null
)
return
null
;
var
result
=
new
Dictionary
<
RedisValue
,
double
>(
sortedSet
.
Length
);
for
(
int
i
=
0
;
i
<
sortedSet
.
Length
;
i
++)
var
result
=
new
Dictionary
<
RedisValue
,
double
>(
sortedSet
.
Length
);
{
for
(
int
i
=
0
;
i
<
sortedSet
.
Length
;
i
++)
result
.
Add
(
sortedSet
[
i
].
element
,
sortedSet
[
i
].
score
);
{
}
result
.
Add
(
sortedSet
[
i
].
element
,
sortedSet
[
i
].
score
);
return
result
;
}
}
return
result
;
}
/// <summary>
/// Create a dictionary from an array of key/value pairs
/// <summary>
/// </summary>
/// Create a dictionary from an array of key/value pairs
public
static
Dictionary
<
string
,
string
>
ToStringDictionary
(
this
KeyValuePair
<
RedisKey
,
RedisValue
>[]
pairs
)
/// </summary>
{
public
static
Dictionary
<
string
,
string
>
ToStringDictionary
(
this
KeyValuePair
<
RedisKey
,
RedisValue
>[]
pairs
)
if
(
pairs
==
null
)
return
null
;
{
if
(
pairs
==
null
)
return
null
;
var
result
=
new
Dictionary
<
string
,
string
>(
pairs
.
Length
,
StringComparer
.
Ordinal
);
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
var
result
=
new
Dictionary
<
string
,
string
>(
pairs
.
Length
,
StringComparer
.
Ordinal
);
{
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
{
}
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
return
result
;
}
}
return
result
;
}
/// <summary>
/// Create a dictionary from an array of key/value pairs
/// <summary>
/// </summary>
/// Create a dictionary from an array of key/value pairs
public
static
Dictionary
<
RedisKey
,
RedisValue
>
ToDictionary
(
this
KeyValuePair
<
RedisKey
,
RedisValue
>[]
pairs
)
/// </summary>
{
public
static
Dictionary
<
RedisKey
,
RedisValue
>
ToDictionary
(
this
KeyValuePair
<
RedisKey
,
RedisValue
>[]
pairs
)
if
(
pairs
==
null
)
return
null
;
{
if
(
pairs
==
null
)
return
null
;
var
result
=
new
Dictionary
<
RedisKey
,
RedisValue
>(
pairs
.
Length
);
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
var
result
=
new
Dictionary
<
RedisKey
,
RedisValue
>(
pairs
.
Length
);
{
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
{
}
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
return
result
;
}
}
return
result
;
}
/// <summary>
/// Create a dictionary from an array of string pairs
/// <summary>
/// </summary>
/// Create a dictionary from an array of string pairs
public
static
Dictionary
<
string
,
string
>
ToDictionary
(
this
KeyValuePair
<
string
,
string
>[]
pairs
)
/// </summary>
{
public
static
Dictionary
<
string
,
string
>
ToDictionary
(
this
KeyValuePair
<
string
,
string
>[]
pairs
)
if
(
pairs
==
null
)
return
null
;
{
if
(
pairs
==
null
)
return
null
;
var
result
=
new
Dictionary
<
string
,
string
>(
pairs
.
Length
,
StringComparer
.
Ordinal
);
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
var
result
=
new
Dictionary
<
string
,
string
>(
pairs
.
Length
,
StringComparer
.
Ordinal
);
{
for
(
int
i
=
0
;
i
<
pairs
.
Length
;
i
++)
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
{
}
result
.
Add
(
pairs
[
i
].
Key
,
pairs
[
i
].
Value
);
return
result
;
}
}
return
result
;
}
static
readonly
string
[]
nix
=
new
string
[
0
];
/// <summary>
static
readonly
string
[]
nix
=
new
string
[
0
];
/// Create an array of strings from an array of values
/// <summary>
/// </summary>
/// Create an array of strings from an array of values
public
static
string
[]
ToStringArray
(
this
RedisValue
[]
values
)
/// </summary>
{
public
static
string
[]
ToStringArray
(
this
RedisValue
[]
values
)
if
(
values
==
null
)
return
null
;
{
if
(
values
.
Length
==
0
)
return
nix
;
if
(
values
==
null
)
return
null
;
return
Array
.
ConvertAll
(
values
,
x
=>
(
string
)
x
);
if
(
values
.
Length
==
0
)
return
nix
;
}
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
/// <summary>
{
/// Represents a general-purpose result from redis, that may be cast into various anticipated types
/// <summary>
/// </summary>
/// Represents a general-purpose result from redis, that may be cast into various anticipated types
public
abstract
class
RedisResult
/// </summary>
{
public
abstract
class
RedisResult
{
// internally, this is very similar to RawResult, except it is designed to be usable
// outside of the IO-processing pipeline: the buffers are standalone, etc
// internally, this is very similar to RawResult, except it is designed to be usable
// outside of the IO-processing pipeline: the buffers are standalone, etc
internal
static
RedisResult
TryCreate
(
PhysicalConnection
connection
,
RawResult
result
)
{
internal
static
RedisResult
TryCreate
(
PhysicalConnection
connection
,
RawResult
result
)
try
{
{
try
switch
(
result
.
Type
)
{
{
switch
(
result
.
Type
)
case
ResultType
.
Integer
:
{
case
ResultType
.
SimpleString
:
case
ResultType
.
Integer
:
case
ResultType
.
BulkString
:
case
ResultType
.
SimpleString
:
return
new
SingleRedisResult
(
result
.
AsRedisValue
());
case
ResultType
.
BulkString
:
case
ResultType
.
MultiBulk
:
return
new
SingleRedisResult
(
result
.
AsRedisValue
());
var
items
=
result
.
GetItems
();
case
ResultType
.
MultiBulk
:
var
arr
=
new
RedisResult
[
items
.
Length
];
var
items
=
result
.
GetItems
();
for
(
int
i
=
0
;
i
<
arr
.
Length
;
i
++)
var
arr
=
new
RedisResult
[
items
.
Length
];
{
for
(
int
i
=
0
;
i
<
arr
.
Length
;
i
++)
var
next
=
TryCreate
(
connection
,
items
[
i
]);
{
if
(
next
==
null
)
return
null
;
// means we didn't understand
var
next
=
TryCreate
(
connection
,
items
[
i
]);
arr
[
i
]
=
next
;
if
(
next
==
null
)
return
null
;
// means we didn't understand
}
arr
[
i
]
=
next
;
return
new
ArrayRedisResult
(
arr
);
}
case
ResultType
.
Error
:
return
new
ArrayRedisResult
(
arr
);
return
new
ErrorRedisResult
(
result
.
GetString
());
case
ResultType
.
Error
:
default
:
return
new
ErrorRedisResult
(
result
.
GetString
());
return
null
;
default
:
}
return
null
;
}
catch
(
Exception
ex
)
}
{
}
catch
(
Exception
ex
)
if
(
connection
!=
null
)
connection
.
OnInternalError
(
ex
);
{
return
null
;
// will be logged as a protocol fail by the processor
if
(
connection
!=
null
)
connection
.
OnInternalError
(
ex
);
}
return
null
;
// will be logged as a protocol fail by the processor
}
}
}
/// <summary>
/// Indicates whether this result was a null result
/// <summary>
/// </summary>
/// Indicates whether this result was a null result
public
abstract
bool
IsNull
{
get
;
}
/// </summary>
public
abstract
bool
IsNull
{
get
;
}
/// <summary>
/// Interprets the result as a String
/// <summary>
/// </summary>
/// Interprets the result as a String
public
static
explicit
operator
string
(
RedisResult
result
)
{
return
result
.
AsString
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
string
(
RedisResult
result
)
{
return
result
.
AsString
();
}
/// Interprets the result as a Byte[]
/// <summary>
/// </summary>
/// Interprets the result as a Byte[]
public
static
explicit
operator
byte
[]
(
RedisResult
result
)
{
return
result
.
AsByteArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
byte
[]
(
RedisResult
result
)
{
return
result
.
AsByteArray
();
}
/// Interprets the result as a Double
/// <summary>
/// </summary>
/// Interprets the result as a Double
public
static
explicit
operator
double
(
RedisResult
result
)
{
return
result
.
AsDouble
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
double
(
RedisResult
result
)
{
return
result
.
AsDouble
();
}
/// Interprets the result as an Int64
/// <summary>
/// </summary>
/// Interprets the result as an Int64
public
static
explicit
operator
long
(
RedisResult
result
)
{
return
result
.
AsInt64
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
long
(
RedisResult
result
)
{
return
result
.
AsInt64
();
}
/// Interprets the result as an Int32
/// <summary>
/// </summary>
/// Interprets the result as an Int32
public
static
explicit
operator
int
(
RedisResult
result
)
{
return
result
.
AsInt32
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
int
(
RedisResult
result
)
{
return
result
.
AsInt32
();
}
/// Interprets the result as a Boolean
/// <summary>
/// </summary>
/// Interprets the result as a Boolean
public
static
explicit
operator
bool
(
RedisResult
result
)
{
return
result
.
AsBoolean
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
bool
(
RedisResult
result
)
{
return
result
.
AsBoolean
();
}
/// Interprets the result as a RedisValue
/// <summary>
/// </summary>
/// Interprets the result as a RedisValue
public
static
explicit
operator
RedisValue
(
RedisResult
result
)
{
return
result
.
AsRedisValue
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
RedisValue
(
RedisResult
result
)
{
return
result
.
AsRedisValue
();
}
/// Interprets the result as a RedisKey
/// <summary>
/// </summary>
/// Interprets the result as a RedisKey
public
static
explicit
operator
RedisKey
(
RedisResult
result
)
{
return
result
.
AsRedisKey
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
RedisKey
(
RedisResult
result
)
{
return
result
.
AsRedisKey
();
}
/// Interprets the result as a Nullable Double
/// <summary>
/// </summary>
/// Interprets the result as a Nullable Double
public
static
explicit
operator
double
?
(
RedisResult
result
)
{
return
result
.
AsNullableDouble
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
double
?
(
RedisResult
result
)
{
return
result
.
AsNullableDouble
();
}
/// Interprets the result as a Nullable Int64
/// <summary>
/// </summary>
/// Interprets the result as a Nullable Int64
public
static
explicit
operator
long
?
(
RedisResult
result
)
{
return
result
.
AsNullableInt64
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
long
?
(
RedisResult
result
)
{
return
result
.
AsNullableInt64
();
}
/// Interprets the result as a Nullable Int32
/// <summary>
/// </summary>
/// Interprets the result as a Nullable Int32
public
static
explicit
operator
int
?
(
RedisResult
result
)
{
return
result
.
AsNullableInt32
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
int
?
(
RedisResult
result
)
{
return
result
.
AsNullableInt32
();
}
/// Interprets the result as a Nullable Boolean
/// <summary>
/// </summary>
/// Interprets the result as a Nullable Boolean
public
static
explicit
operator
bool
?
(
RedisResult
result
)
{
return
result
.
AsNullableBoolean
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
bool
?
(
RedisResult
result
)
{
return
result
.
AsNullableBoolean
();
}
/// Interprets the result as an array of String
/// <summary>
/// </summary>
/// Interprets the result as an array of String
public
static
explicit
operator
string
[]
(
RedisResult
result
)
{
return
result
.
AsStringArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
string
[]
(
RedisResult
result
)
{
return
result
.
AsStringArray
();
}
/// Interprets the result as an array of Byte[]
/// <summary>
/// </summary>
/// Interprets the result as an array of Byte[]
public
static
explicit
operator
byte
[][]
(
RedisResult
result
)
{
return
result
.
AsByteArrayArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
byte
[][]
(
RedisResult
result
)
{
return
result
.
AsByteArrayArray
();
}
/// Interprets the result as an array of Double
/// <summary>
/// </summary>
/// Interprets the result as an array of Double
public
static
explicit
operator
double
[]
(
RedisResult
result
)
{
return
result
.
AsDoubleArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
double
[]
(
RedisResult
result
)
{
return
result
.
AsDoubleArray
();
}
/// Interprets the result as an array of Int64
/// <summary>
/// </summary>
/// Interprets the result as an array of Int64
public
static
explicit
operator
long
[]
(
RedisResult
result
)
{
return
result
.
AsInt64Array
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
long
[]
(
RedisResult
result
)
{
return
result
.
AsInt64Array
();
}
/// Interprets the result as an array of Int32
/// <summary>
/// </summary>
/// Interprets the result as an array of Int32
public
static
explicit
operator
int
[]
(
RedisResult
result
)
{
return
result
.
AsInt32Array
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
int
[]
(
RedisResult
result
)
{
return
result
.
AsInt32Array
();
}
/// Interprets the result as an array of Boolean
/// <summary>
/// </summary>
/// Interprets the result as an array of Boolean
public
static
explicit
operator
bool
[]
(
RedisResult
result
)
{
return
result
.
AsBooleanArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
bool
[]
(
RedisResult
result
)
{
return
result
.
AsBooleanArray
();
}
/// Interprets the result as an array of RedisValue
/// <summary>
/// </summary>
/// Interprets the result as an array of RedisValue
public
static
explicit
operator
RedisValue
[]
(
RedisResult
result
)
{
return
result
.
AsRedisValueArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
RedisValue
[]
(
RedisResult
result
)
{
return
result
.
AsRedisValueArray
();
}
/// Interprets the result as an array of RedisKey
/// <summary>
/// </summary>
/// Interprets the result as an array of RedisKey
public
static
explicit
operator
RedisKey
[]
(
RedisResult
result
)
{
return
result
.
AsRedisKeyArray
();
}
/// </summary>
/// <summary>
public
static
explicit
operator
RedisKey
[]
(
RedisResult
result
)
{
return
result
.
AsRedisKeyArray
();
}
/// Interprets the result as an array of RedisResult
/// <summary>
/// </summary>
/// Interprets the result as an array of RedisResult
public
static
explicit
operator
RedisResult
[]
(
RedisResult
result
)
{
return
result
.
AsRedisResultArray
();
}
/// </summary>
public
static
explicit
operator
RedisResult
[]
(
RedisResult
result
)
{
return
result
.
AsRedisResultArray
();
}
internal
abstract
bool
AsBoolean
();
internal
abstract
bool
AsBoolean
();
internal
abstract
bool
[]
AsBooleanArray
();
internal
abstract
bool
[]
AsBooleanArray
();
internal
abstract
byte
[]
AsByteArray
();
internal
abstract
byte
[]
AsByteArray
();
internal
abstract
byte
[][]
AsByteArrayArray
();
internal
abstract
byte
[][]
AsByteArrayArray
();
internal
abstract
double
AsDouble
();
internal
abstract
double
AsDouble
();
internal
abstract
double
[]
AsDoubleArray
();
internal
abstract
double
[]
AsDoubleArray
();
internal
abstract
int
AsInt32
();
internal
abstract
int
AsInt32
();
internal
abstract
int
[]
AsInt32Array
();
internal
abstract
int
[]
AsInt32Array
();
internal
abstract
long
AsInt64
();
internal
abstract
long
AsInt64
();
internal
abstract
long
[]
AsInt64Array
();
internal
abstract
long
[]
AsInt64Array
();
internal
abstract
bool
?
AsNullableBoolean
();
internal
abstract
bool
?
AsNullableBoolean
();
internal
abstract
double
?
AsNullableDouble
();
internal
abstract
double
?
AsNullableDouble
();
internal
abstract
int
?
AsNullableInt32
();
internal
abstract
int
?
AsNullableInt32
();
internal
abstract
long
?
AsNullableInt64
();
internal
abstract
long
?
AsNullableInt64
();
internal
abstract
RedisKey
AsRedisKey
();
internal
abstract
RedisKey
AsRedisKey
();
internal
abstract
RedisKey
[]
AsRedisKeyArray
();
internal
abstract
RedisKey
[]
AsRedisKeyArray
();
internal
abstract
RedisResult
[]
AsRedisResultArray
();
internal
abstract
RedisResult
[]
AsRedisResultArray
();
internal
abstract
RedisValue
AsRedisValue
();
internal
abstract
RedisValue
AsRedisValue
();
internal
abstract
RedisValue
[]
AsRedisValueArray
();
internal
abstract
string
AsString
();
internal
abstract
RedisValue
[]
AsRedisValueArray
();
internal
abstract
string
[]
AsStringArray
();
internal
abstract
string
AsString
();
private
sealed
class
ArrayRedisResult
:
RedisResult
internal
abstract
string
[]
AsStringArray
();
{
private
sealed
class
ArrayRedisResult
:
RedisResult
public
override
bool
IsNull
{
{
public
override
bool
IsNull
get
{
return
value
==
null
;
}
{
}
get
{
return
value
==
null
;
}
private
readonly
RedisResult
[]
value
;
}
public
ArrayRedisResult
(
RedisResult
[]
value
)
private
readonly
RedisResult
[]
value
;
{
public
ArrayRedisResult
(
RedisResult
[]
value
)
if
(
value
==
null
)
throw
new
ArgumentNullException
(
"value"
);
{
this
.
value
=
value
;
if
(
value
==
null
)
throw
new
ArgumentNullException
(
"value"
);
}
this
.
value
=
value
;
public
override
string
ToString
()
}
{
public
override
string
ToString
()
return
value
.
Length
+
" element(s)"
;
{
}
return
value
.
Length
+
" element(s)"
;
internal
override
bool
AsBoolean
()
}
{
internal
override
bool
AsBoolean
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsBoolean
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsBoolean
();
}
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
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsByteArray
();
}
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
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsDouble
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsDouble
();
}
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
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsInt32
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsInt32
();
}
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
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsInt64
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsInt64
();
}
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
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableBoolean
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableBoolean
();
}
throw
new
InvalidCastException
();
}
internal
override
double
?
AsNullableDouble
()
{
internal
override
double
?
AsNullableDouble
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableDouble
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableDouble
();
}
throw
new
InvalidCastException
();
}
internal
override
int
?
AsNullableInt32
()
{
internal
override
int
?
AsNullableInt32
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableInt32
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableInt32
();
}
throw
new
InvalidCastException
();
}
internal
override
long
?
AsNullableInt64
()
{
internal
override
long
?
AsNullableInt64
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableInt64
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsNullableInt64
();
}
throw
new
InvalidCastException
();
}
internal
override
RedisKey
AsRedisKey
()
{
internal
override
RedisKey
AsRedisKey
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsRedisKey
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsRedisKey
();
}
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
;
}
internal
override
RedisValue
AsRedisValue
()
{
internal
override
RedisValue
AsRedisValue
()
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsRedisValue
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsRedisValue
();
}
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
();
{
throw
new
InvalidCastException
();
if
(
value
.
Length
==
1
)
return
value
[
0
].
AsString
();
}
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
private
readonly
string
value
;
{
public
ErrorRedisResult
(
string
value
)
private
readonly
string
value
;
{
public
ErrorRedisResult
(
string
value
)
if
(
value
==
null
)
throw
new
ArgumentNullException
(
"value"
);
{
this
.
value
=
value
;
if
(
value
==
null
)
throw
new
ArgumentNullException
(
"value"
);
}
this
.
value
=
value
;
public
override
bool
IsNull
}
{
public
override
bool
IsNull
get
{
return
value
==
null
;
}
{
}
get
{
return
value
==
null
;
}
public
override
string
ToString
()
{
return
value
;
}
}
internal
override
bool
AsBoolean
()
{
throw
new
RedisServerException
(
value
);
}
public
override
string
ToString
()
{
return
value
;
}
internal
override
bool
AsBoolean
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
bool
[]
AsBooleanArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
bool
[]
AsBooleanArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
byte
[]
AsByteArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
byte
[]
AsByteArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
byte
[][]
AsByteArrayArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
byte
[][]
AsByteArrayArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
AsDouble
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
AsDouble
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
[]
AsDoubleArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
[]
AsDoubleArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
AsInt32
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
AsInt32
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
[]
AsInt32Array
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
[]
AsInt32Array
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
AsInt64
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
AsInt64
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
[]
AsInt64Array
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
[]
AsInt64Array
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
bool
?
AsNullableBoolean
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
bool
?
AsNullableBoolean
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
?
AsNullableDouble
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
double
?
AsNullableDouble
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
?
AsNullableInt32
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
int
?
AsNullableInt32
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
?
AsNullableInt64
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
long
?
AsNullableInt64
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisKey
AsRedisKey
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisKey
AsRedisKey
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisValue
AsRedisValue
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisValue
AsRedisValue
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
string
AsString
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
string
[]
AsStringArray
()
{
throw
new
RedisServerException
(
value
);
}
internal
override
string
AsString
()
{
throw
new
RedisServerException
(
value
);
}
}
internal
override
string
[]
AsStringArray
()
{
throw
new
RedisServerException
(
value
);
}
}
private
sealed
class
SingleRedisResult
:
RedisResult
{
private
sealed
class
SingleRedisResult
:
RedisResult
private
readonly
RedisValue
value
;
{
public
SingleRedisResult
(
RedisValue
value
)
private
readonly
RedisValue
value
;
{
public
SingleRedisResult
(
RedisValue
value
)
this
.
value
=
value
;
{
}
this
.
value
=
value
;
}
public
override
bool
IsNull
{
public
override
bool
IsNull
get
{
return
value
.
IsNull
;
}
{
}
get
{
return
value
.
IsNull
;
}
}
public
override
string
ToString
()
{
return
value
.
ToString
();
}
internal
override
bool
AsBoolean
()
{
return
(
bool
)
value
;
}
public
override
string
ToString
()
{
return
value
.
ToString
();
}
internal
override
bool
AsBoolean
()
{
return
(
bool
)
value
;
}
internal
override
bool
[]
AsBooleanArray
()
{
return
new
[]
{
AsBoolean
()
};
}
internal
override
bool
[]
AsBooleanArray
()
{
return
new
[]
{
AsBoolean
()
};
}
internal
override
byte
[]
AsByteArray
()
{
return
(
byte
[])
value
;
}
internal
override
byte
[][]
AsByteArrayArray
()
{
return
new
[]
{
AsByteArray
()
};
}
internal
override
byte
[]
AsByteArray
()
{
return
(
byte
[])
value
;
}
internal
override
byte
[][]
AsByteArrayArray
()
{
return
new
[]
{
AsByteArray
()
};
}
internal
override
double
AsDouble
()
{
return
(
double
)
value
;
}
internal
override
double
AsDouble
()
{
return
(
double
)
value
;
}
internal
override
double
[]
AsDoubleArray
()
{
return
new
[]
{
AsDouble
()
};
}
internal
override
double
[]
AsDoubleArray
()
{
return
new
[]
{
AsDouble
()
};
}
internal
override
int
AsInt32
()
{
return
(
int
)
value
;
}
internal
override
int
AsInt32
()
{
return
(
int
)
value
;
}
internal
override
int
[]
AsInt32Array
()
{
return
new
[]
{
AsInt32
()
};
}
internal
override
int
[]
AsInt32Array
()
{
return
new
[]
{
AsInt32
()
};
}
internal
override
long
AsInt64
()
{
return
(
long
)
value
;
}
internal
override
long
AsInt64
()
{
return
(
long
)
value
;
}
internal
override
long
[]
AsInt64Array
()
{
return
new
[]
{
AsInt64
()
};
}
internal
override
long
[]
AsInt64Array
()
{
return
new
[]
{
AsInt64
()
};
}
internal
override
bool
?
AsNullableBoolean
()
{
return
(
bool
?)
value
;
}
internal
override
bool
?
AsNullableBoolean
()
{
return
(
bool
?)
value
;
}
internal
override
double
?
AsNullableDouble
()
{
return
(
double
?)
value
;
}
internal
override
double
?
AsNullableDouble
()
{
return
(
double
?)
value
;
}
internal
override
int
?
AsNullableInt32
()
{
return
(
int
?)
value
;
}
internal
override
int
?
AsNullableInt32
()
{
return
(
int
?)
value
;
}
internal
override
long
?
AsNullableInt64
()
{
return
(
long
?)
value
;
}
internal
override
long
?
AsNullableInt64
()
{
return
(
long
?)
value
;
}
internal
override
RedisKey
AsRedisKey
()
{
return
(
byte
[])
value
;
}
internal
override
RedisKey
AsRedisKey
()
{
return
(
byte
[])
value
;
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
return
new
[]
{
AsRedisKey
()
};
}
internal
override
RedisKey
[]
AsRedisKeyArray
()
{
return
new
[]
{
AsRedisKey
()
};
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
throw
new
InvalidCastException
();
}
internal
override
RedisResult
[]
AsRedisResultArray
()
{
throw
new
InvalidCastException
();
}
internal
override
RedisValue
AsRedisValue
()
{
return
value
;
}
internal
override
RedisValue
AsRedisValue
()
{
return
value
;
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
return
new
[]
{
AsRedisValue
()
};
}
internal
override
RedisValue
[]
AsRedisValueArray
()
{
return
new
[]
{
AsRedisValue
()
};
}
internal
override
string
AsString
()
{
return
(
string
)
value
;
}
internal
override
string
[]
AsStringArray
()
{
return
new
[]
{
AsString
()
};
}
internal
override
string
AsString
()
{
return
(
string
)
value
;
}
}
internal
override
string
[]
AsStringArray
()
{
return
new
[]
{
AsString
()
};
}
}
}
}
}
}
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