Core/Refactor: Part 2

This commit is contained in:
hondacrx
2018-05-07 22:07:35 -04:00
parent 216db1c23a
commit 9b40067017
93 changed files with 321 additions and 388 deletions
+3 -6
View File
@@ -57,7 +57,7 @@ namespace System
public static byte[] ToByteArray(this string value, char separator)
{
return Array.ConvertAll(value.Split(separator), s => byte.Parse(s));
return Array.ConvertAll(value.Split(separator), byte.Parse);
}
static uint LeftRotate(this uint value, int shiftCount)
@@ -144,7 +144,7 @@ namespace System
ret = (BigInteger)Convert.ChangeType(value, typeof(BigInteger));
break;
default:
throw new NotSupportedException(string.Format("'{0}' conversion to 'BigInteger' not supported.", typeof(T).Name));
throw new NotSupportedException($"'{typeof(T).Name}' conversion to 'BigInteger' not supported.");
}
return ret;
@@ -268,10 +268,7 @@ namespace System
string pattern = @"(%\W*\d*[a-zA-Z]*)";
int count = 0;
string result = Regex.Replace(str, pattern, m =>
{
return string.Concat("{", count++, "}");
});
string result = Regex.Replace(str, pattern, m => string.Concat("{", count++, "}"));
return result;
}
+1 -1
View File
@@ -19,7 +19,7 @@ using System.Diagnostics.Contracts;
public class RandomHelper
{
private readonly static Random rand;
private static readonly Random rand;
static RandomHelper()
{
+1 -1
View File
@@ -185,7 +185,7 @@ public static class Time
long hours = (time % Day) / Hour;
long minute = (time % Hour) / Minute;
return string.Format("Days: {0} Hours: {1} Minutes: {2}", days, hours, minute);
return $"Days: {days} Hours: {hours} Minutes: {minute}";
}
public static void Profile(string description, int iterations, Action func)