Skip to content

Commit b5151f2

Browse files
committed
Switch to collection expressions.
1 parent a1f1e02 commit b5151f2

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/Magick.NET.Core/Profiles/Exif/Values/ExifArrayValue{TValueType}.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ internal abstract class ExifArrayValue<TValueType> : ExifValue, IExifValue<TValu
88
public ExifArrayValue(ExifTag<TValueType[]> tag)
99
: base(tag)
1010
{
11-
Value = new TValueType[] { };
11+
Value = [];
1212
}
1313

1414
public ExifArrayValue(ExifTagValue tag)
1515
: base(tag)
1616
{
17-
Value = new TValueType[] { };
17+
Value = [];
1818
}
1919

2020
public override bool IsArray => true;
@@ -37,7 +37,7 @@ public override bool SetValue(object value)
3737

3838
if (value is TValueType typeValue)
3939
{
40-
Value = new TValueType[] { typeValue };
40+
Value = [typeValue];
4141
return true;
4242
}
4343

src/Magick.NET/Colors/MagickColor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,9 @@ public void SetFromBytes(byte red, byte green, byte blue, byte alpha)
423423
public byte[] ToByteArray()
424424
{
425425
if (IsCmyk)
426-
return new[] { Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(K), Quantum.ScaleToByte(A) };
426+
return [Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(K), Quantum.ScaleToByte(A)];
427427
else
428-
return new[] { Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(A) };
428+
return [Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(A)];
429429
}
430430

431431
/// <summary>

src/Magick.NET/Drawing/DrawableFont.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ImageMagick.Drawing;
1010
/// </summary>
1111
public sealed class DrawableFont : IDrawableFont, IDrawingWand
1212
{
13-
private static readonly string[] _fontExtensions = new string[] { ".ttf", ".ttc", ".pfb", ".pfm", ".otf" };
13+
private static readonly string[] _fontExtensions = [".ttf", ".ttc", ".pfb", ".pfm", ".otf"];
1414

1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="DrawableFont"/> class.

src/Magick.NET/Statistics/ChannelPerceptualHash.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private sealed class HuPhashList
176176
private readonly double[] _values;
177177

178178
public HuPhashList()
179-
: this(new double[] { 0, 0, 0, 0, 0, 0, 0 })
179+
: this([0, 0, 0, 0, 0, 0, 0])
180180
{
181181
}
182182

src/Magick.NET/Statistics/PerceptualHash.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ internal PerceptualHash(IMagickImage image, ColorSpace[] colorSpaces, IntPtr lis
5151
AddChannel(image, colorSpaces, list, PixelChannel.Blue);
5252
}
5353

54-
internal static ColorSpace[] DefaultColorSpaces { get; } = new[] { ColorSpace.sRGB, ColorSpace.HCLp };
54+
internal static ColorSpace[] DefaultColorSpaces { get; } = [ColorSpace.sRGB, ColorSpace.HCLp];
5555

5656
internal bool Isvalid
5757
=> _channels.ContainsKey(PixelChannel.Red) &&

src/Shared/MemberNotNullAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace System.Diagnostics.CodeAnalysis;
88
internal sealed class MemberNotNullAttribute : Attribute
99
{
1010
public MemberNotNullAttribute(string member)
11-
=> Members = new[] { member };
11+
=> Members = [member];
1212

1313
public MemberNotNullAttribute(params string[] members)
1414
=> Members = members;

0 commit comments

Comments
 (0)