Core/Refactor: Part 2
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ using System.Diagnostics.Contracts;
|
||||
|
||||
public class RandomHelper
|
||||
{
|
||||
private readonly static Random rand;
|
||||
private static readonly Random rand;
|
||||
|
||||
static RandomHelper()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user