Visual Studio C#7 suggestions

This commit is contained in:
Christopher F
2017-04-23 15:23:06 -04:00
parent 6000b15c4d
commit 431b7fbd9f
21 changed files with 80 additions and 165 deletions

View File

@@ -239,10 +239,8 @@ namespace Discord
{
while (true)
{
int bucketNo, lockNo;
Tables tables = _tables;
GetBucketAndLockNo(hashcode, out bucketNo, out lockNo, tables._buckets.Length, tables._locks.Length);
GetBucketAndLockNo(hashcode, out int bucketNo, out int lockNo, tables._buckets.Length, tables._locks.Length);
bool resizeDesired = false;
bool lockTaken = false;
@@ -292,9 +290,7 @@ namespace Discord
while (true)
{
Tables tables = _tables;
int bucketNo, lockNo;
GetBucketAndLockNo(hashcode, out bucketNo, out lockNo, tables._buckets.Length, tables._locks.Length);
GetBucketAndLockNo(hashcode, out int bucketNo, out int lockNo, tables._buckets.Length, tables._locks.Length);
lock (tables._locks[lockNo])
{
@@ -426,8 +422,7 @@ namespace Discord
while (current != null)
{
Node next = current._next;
int newBucketNo, newLockNo;
GetBucketAndLockNo(current._hashcode, out newBucketNo, out newLockNo, newBuckets.Length, newLocks.Length);
GetBucketAndLockNo(current._hashcode, out int newBucketNo, out int newLockNo, newBuckets.Length, newLocks.Length);
newBuckets[newBucketNo] = new Node(current._value, current._hashcode, newBuckets[newBucketNo]);

View File

@@ -19,8 +19,7 @@ namespace Discord
/// <summary> Parses a provided user mention string. </summary>
public static ulong ParseUser(string text)
{
ulong id;
if (TryParseUser(text, out id))
if (TryParseUser(text, out ulong id))
return id;
throw new ArgumentException("Invalid mention format", nameof(text));
}
@@ -44,8 +43,7 @@ namespace Discord
/// <summary> Parses a provided channel mention string. </summary>
public static ulong ParseChannel(string text)
{
ulong id;
if (TryParseChannel(text, out id))
if (TryParseChannel(text, out ulong id))
return id;
throw new ArgumentException("Invalid mention format", nameof(text));
}
@@ -66,8 +64,7 @@ namespace Discord
/// <summary> Parses a provided role mention string. </summary>
public static ulong ParseRole(string text)
{
ulong id;
if (TryParseRole(text, out id))
if (TryParseRole(text, out ulong id))
return id;
throw new ArgumentException("Invalid mention format", nameof(text));
}