Code style - Omit the type in a new expressions

This commit is contained in:
SpoinkyNL committed 2020-12-18 17:54:01 +01:00
1 parent 099f56f4fe
commit 10e6cdc54b
117 files changed
+251 -252

No files matched your search

@@ -84,7 +84,7 @@ namespace Artemis.Core
IEnumerable<TSource> _()
{
HashSet<TKey> knownKeys = new HashSet<TKey>(comparer);
HashSet<TKey> knownKeys = new(comparer);
foreach (TSource element in source)
{
if (knownKeys.Add(keySelector(element)))
@@ -19,7 +19,7 @@ namespace Artemis.Core
public static string GetProcessFilename(this Process p)
{
int capacity = 2000;
StringBuilder builder = new StringBuilder(capacity);
StringBuilder builder = new(capacity);
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity)) return string.Empty;
@@ -8,7 +8,7 @@ namespace Artemis.Core
{
public static string GetDeviceIdentifier(this IRGBDevice rgbDevice)
{
StringBuilder builder = new StringBuilder();
StringBuilder builder = new();
builder.Append(rgbDevice.DeviceInfo.DeviceName);
builder.Append('-');
builder.Append(rgbDevice.DeviceInfo.Manufacturer);
@@ -16,7 +16,7 @@ namespace Artemis.Core
/// <returns>The RGB.NET color</returns>
public static Color ToRgbColor(this SKColor color)
{
return new Color(color.Alpha, color.Red, color.Green, color.Blue);
return new(color.Alpha, color.Red, color.Green, color.Blue);
}
/// <summary>
@@ -49,7 +49,7 @@ namespace Artemis.Core
/// <returns>The sum of the two colors</returns>
public static SKColor Sum(this SKColor a, SKColor b)
{
return new SKColor(
return new(
ClampToByte(a.Red + b.Red),
ClampToByte(a.Green + b.Green),
ClampToByte(a.Blue + b.Blue),
@@ -11,7 +11,7 @@ namespace Artemis.Core
/// </summary>
public static class TypeExtensions
{
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new Dictionary<Type, List<Type>>
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new()
{
{typeof(decimal), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
{typeof(double), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
@@ -24,7 +24,7 @@ namespace Artemis.Core
{typeof(short), new List<Type> {typeof(byte)}}
};
private static readonly Dictionary<Type, string> TypeKeywords = new Dictionary<Type, string>
private static readonly Dictionary<Type, string> TypeKeywords = new()
{
{typeof(bool), "bool"},
{typeof(byte), "byte"},