Skip to content

Commit edfbd50

Browse files
committed
Refactoring
1 parent 6ead898 commit edfbd50

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

src/ImageWizard.Core/Caches/OneTimeCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ImageWizard.Caches;
1010
class OneTimeCache : ICache
1111
{
1212
private IMetadata? _metadata;
13-
private byte[] _data = Array.Empty<byte>();
13+
private byte[] _data = [];
1414

1515
public async Task<ICachedData?> ReadAsync(string key)
1616
{

src/ImageWizard.Core/Loaders/Http/HttpHeaderItem.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ namespace ImageWizard.Loaders;
77
/// <summary>
88
/// HttpHeaderItem
99
/// </summary>
10-
public class HttpHeaderItem
10+
public class HttpHeaderItem(string name, string value)
1111
{
12-
public HttpHeaderItem(string name, string value)
13-
{
14-
Name = name;
15-
Value = value;
16-
}
17-
1812
/// <summary>
1913
/// Name
2014
/// </summary>
21-
public string Name { get; set; }
15+
public string Name { get; set; } = name;
2216

2317
/// <summary>
2418
/// Value
2519
/// </summary>
26-
public string Value { get; set; }
20+
public string Value { get; set; } = value;
2721
}

src/ImageWizard.Core/Loaders/Http/HttpLoaderOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public HttpLoaderOptions()
1717
/// <summary>
1818
/// Custom http header entries.
1919
/// </summary>
20-
public IList<HttpHeaderItem> Headers { get; } = new List<HttpHeaderItem>();
20+
public IList<HttpHeaderItem> Headers { get; } = [];
2121

2222
/// <summary>
2323
/// Sets default base url for relative urls.
@@ -32,7 +32,7 @@ public HttpLoaderOptions()
3232
/// <summary>
3333
/// Allows only specified hosts.
3434
/// </summary>
35-
public string[] AllowedHosts { get; set; } = Array.Empty<string>();
35+
public string[] AllowedHosts { get; set; } = [];
3636

3737
public HttpLoaderOptions SetHeader(string name, string value)
3838
{

0 commit comments

Comments
 (0)