Commit 4074eadd authored by Jeremy Meng's avatar Jeremy Meng

Replace Array.ConvertAll() with Linq Select() calls.

parent 78e6335f
......@@ -130,7 +130,7 @@ public void IntentionalWrongServer()
using (var conn = Create())
{
var endpoints = conn.GetEndPoints();
var servers = Array.ConvertAll(endpoints, e => conn.GetServer(e));
var servers = endpoints.Select(e => conn.GetServer(e));
var key = Me();
const string value = "abc";
......@@ -368,7 +368,7 @@ public void Keys(string pattern, int pageSize)
using (var conn = Create(allowAdmin: true))
{
var cluster = conn.GetDatabase();
var server = Array.ConvertAll(conn.GetEndPoints(), x => conn.GetServer(x)).First(x => !x.IsSlave);
var server = conn.GetEndPoints().Select(x => conn.GetServer(x)).First(x => !x.IsSlave);
server.FlushAllDatabases();
try
{
......@@ -474,7 +474,7 @@ public void AccessRandomKeys()
Task[] send = new Task[COUNT];
int index = 0;
var servers = Array.ConvertAll(conn.GetEndPoints(), x => conn.GetServer(x));
var servers = conn.GetEndPoints().Select(x => conn.GetServer(x));
foreach (var server in servers)
{
if (!server.IsSlave)
......@@ -600,7 +600,7 @@ public void MovedProfiling()
conn.RegisterProfiler(profiler);
var endpoints = conn.GetEndPoints();
var servers = Array.ConvertAll(endpoints, e => conn.GetServer(e));
var servers = endpoints.Select(e => conn.GetServer(e));
conn.BeginProfiling(profiler.MyContext);
var db = conn.GetDatabase();
......
......@@ -22,7 +22,7 @@ public void CannotFlushSlave()
ConfigurationOptions config = GetMasterSlaveConfig();
using (var conn = ConnectionMultiplexer.Connect(config))
{
var servers = Array.ConvertAll(conn.GetEndPoints(), e => conn.GetServer(e));
var servers = conn.GetEndPoints().Select(e => conn.GetServer(e));
var slave = servers.First(x => x.IsSlave);
slave.FlushDatabase();
}
......
......@@ -148,7 +148,7 @@ public void CheckSyncAsyncMethodsMatch(Type from, Type to)
huntType = typeof(Task<>).MakeGenericType(method.ReturnType);
}
var pFrom = method.GetParameters();
Type[] args = Array.ConvertAll(pFrom, x => x.ParameterType);
Type[] args = pFrom.Select(x => x.ParameterType).ToArray();
Assert.AreEqual(typeof(CommandFlags), args.Last());
var found = to.GetMethod(huntName, flags, null, method.CallingConvention, args, null);
Assert.IsNotNull(found, "Found " + name + ", no " + huntName);
......
......@@ -158,7 +158,7 @@ public void TestCallByHash()
var db = conn.GetDatabase();
RedisKey[] keys = { Me() };
string hexHash = string.Concat(Array.ConvertAll(hash, x => x.ToString("X2")));
string hexHash = string.Concat(hash.Select(x => x.ToString("X2")));
Assert.AreEqual("2BAB3B661081DB58BD2341920E0BA7CF5DC77B25", hexHash);
db.ScriptEvaluate(hexHash, keys);
......
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