Commit 157abb43 authored by Nick Craver's avatar Nick Craver

C#6 Cleanup

parent 5abe60bf
...@@ -10,15 +10,13 @@ namespace StackExchange.Redis ...@@ -10,15 +10,13 @@ namespace StackExchange.Redis
/// </summary> /// </summary>
internal static class InternalRegexCompiledOption internal static class InternalRegexCompiledOption
{ {
private static readonly RegexOptions RegexCompiledOption;
static InternalRegexCompiledOption() static InternalRegexCompiledOption()
{ {
#if CORE_CLR #if CORE_CLR
if (!Enum.TryParse("Compiled", out RegexCompiledOption)) if (!Enum.TryParse("Compiled", out RegexCompiledOption))
RegexCompiledOption = RegexOptions.None; RegexCompiledOption = RegexOptions.None;
#else #else
RegexCompiledOption = RegexOptions.Compiled; Default = RegexOptions.Compiled;
#endif #endif
} }
...@@ -28,12 +26,6 @@ static InternalRegexCompiledOption() ...@@ -28,12 +26,6 @@ static InternalRegexCompiledOption()
/// This returns <see cref="System.Text.RegularExpressions.RegexOptions.Compiled"/> if it is supported; /// This returns <see cref="System.Text.RegularExpressions.RegexOptions.Compiled"/> if it is supported;
/// <see cref="System.Text.RegularExpressions.RegexOptions.None"/> otherwise. /// <see cref="System.Text.RegularExpressions.RegexOptions.None"/> otherwise.
/// </summary> /// </summary>
public static RegexOptions Default public static RegexOptions Default { get; }
{
get
{
return RegexCompiledOption;
}
}
} }
} }
...@@ -2367,7 +2367,7 @@ public StringGetWithExpiryMessage(int db, CommandFlags flags, RedisCommand ttlCo ...@@ -2367,7 +2367,7 @@ public StringGetWithExpiryMessage(int db, CommandFlags flags, RedisCommand ttlCo
{ {
this.ttlCommand = ttlCommand; this.ttlCommand = ttlCommand;
} }
public override string CommandAndKey { get { return ttlCommand + "+" + RedisCommand.GET + " " + (string)Key; } } public override string CommandAndKey => ttlCommand + "+" + RedisCommand.GET + " " + (string)Key;
public IEnumerable<Message> GetMessages(PhysicalConnection connection) public IEnumerable<Message> GetMessages(PhysicalConnection connection)
{ {
......
...@@ -174,10 +174,7 @@ internal static RedisResult TryCreate(PhysicalConnection connection, RawResult r ...@@ -174,10 +174,7 @@ internal static RedisResult TryCreate(PhysicalConnection connection, RawResult r
internal abstract string[] AsStringArray(); internal abstract string[] AsStringArray();
private sealed class ArrayRedisResult : RedisResult private sealed class ArrayRedisResult : RedisResult
{ {
public override bool IsNull public override bool IsNull => value == null;
{
get { return value == null; }
}
private readonly RedisResult[] value; private readonly RedisResult[] value;
public ArrayRedisResult(RedisResult[] value) public ArrayRedisResult(RedisResult[] value)
{ {
......
...@@ -44,15 +44,11 @@ public ResultBox(object stateOrCompletionSource) ...@@ -44,15 +44,11 @@ public ResultBox(object stateOrCompletionSource)
{ {
this.stateOrCompletionSource = stateOrCompletionSource; this.stateOrCompletionSource = stateOrCompletionSource;
} }
public object AsyncState
{ public object AsyncState =>
get stateOrCompletionSource is TaskCompletionSource<T>
{ ? ((TaskCompletionSource<T>) stateOrCompletionSource).Task.AsyncState
return stateOrCompletionSource is TaskCompletionSource<T> : stateOrCompletionSource;
? ((TaskCompletionSource<T>)stateOrCompletionSource).Task.AsyncState
: stateOrCompletionSource;
}
}
public static ResultBox<T> Get(object stateOrCompletionSource) public static ResultBox<T> Get(object stateOrCompletionSource)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment