Skip to content

Commit f2181b8

Browse files
author
Christoph Bühler
committed
feat: upgrade to C#9.0
1 parent 46e69be commit f2181b8

10 files changed

+13
-11
lines changed

src/KubeOps/Build/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ namespace KubeOps.Build
44
{
55
internal static class Program
66
{
7-
public static Task Main(string[] _) => Task.CompletedTask;
7+
public static Task Main() => Task.CompletedTask;
88
}
99
}

src/KubeOps/Operator/Caching/CacheComparisonResult.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace KubeOps.Operator.Caching
22
{
3+
/// <summary>
4+
/// Result for the <see cref="IResourceCache{TEntity}.Upsert"/> when comparison is done.
5+
/// </summary>
36
public enum CacheComparisonResult
47
{
58
/// <summary>

src/KubeOps/Operator/Caching/ResourceCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal class ResourceCache<TEntity> : IResourceCache<TEntity>
1717
private const string Finalizers = "Metadata.Finalizers";
1818
private const string Status = "Status";
1919

20-
private readonly CompareLogic _compare = new CompareLogic(
20+
private readonly CompareLogic _compare = new(
2121
new ComparisonConfig
2222
{
2323
Caching = true,

src/KubeOps/Operator/Comparing/ArrayExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void ForEach(this Array array, Action<Array, int[]> action)
1111
return;
1212
}
1313

14-
ArrayTraverse walker = new ArrayTraverse(array);
14+
ArrayTraverse walker = new(array);
1515
do
1616
{
1717
action(array, walker.Position);

src/KubeOps/Operator/Entities/CustomKubernetesEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ namespace KubeOps.Operator.Entities
88
/// </summary>
99
public abstract class CustomKubernetesEntity : KubernetesObject, IKubernetesObject<V1ObjectMeta>
1010
{
11-
public V1ObjectMeta Metadata { get; set; } = new V1ObjectMeta();
11+
public V1ObjectMeta Metadata { get; set; } = new();
1212
}
1313
}

src/KubeOps/Operator/Entities/CustomKubernetesEntity{TSpec,TStatus}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public abstract class CustomKubernetesEntity<TSpec, TStatus> : CustomKubernetesE
1414
where TSpec : new()
1515
where TStatus : new()
1616
{
17-
public TStatus Status { get; set; } = new TStatus();
17+
public TStatus Status { get; set; } = new();
1818
}
1919
}

src/KubeOps/Operator/Entities/CustomKubernetesEntity{TSpec}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ namespace KubeOps.Operator.Entities
1010
public abstract class CustomKubernetesEntity<TSpec> : CustomKubernetesEntity, ISpec<TSpec>
1111
where TSpec : new()
1212
{
13-
public TSpec Spec { get; set; } = new TSpec();
13+
public TSpec Spec { get; set; } = new();
1414
}
1515
}

src/KubeOps/Operator/Entities/EntityList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace KubeOps.Operator.Entities
77
public class EntityList<T> : KubernetesObject
88
where T : IKubernetesObject<V1ObjectMeta>
99
{
10-
public V1ListMeta Metadata { get; set; } = new V1ListMeta();
10+
public V1ListMeta Metadata { get; set; } = new();
1111

1212
public IList<T> Items { get; set; } = new List<T>();
1313
}

src/KubeOps/Operator/Errors/ExponentialBackoffHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class ExponentialBackoffHandler : IDisposable
1010
private const double MaxRetrySeconds = 64;
1111
private readonly Action? _retryHandler;
1212
private readonly Func<Task>? _asyncRetryHandler;
13-
private readonly Random _rnd = new Random();
13+
private readonly Random _rnd = new();
1414

1515
private Timer? _retryTimer;
1616
private Timer? _resetTimer;

src/KubeOps/Operator/Queue/ResourceEventQueue.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal class ResourceEventQueue<TEntity> : IResourceEventQueue<TEntity>
2323
private readonly Channel<(ResourceEventType Type, TEntity Resource)> _queue =
2424
Channel.CreateBounded<(ResourceEventType Type, TEntity Resource)>(QueueLimit);
2525

26-
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1);
26+
private readonly SemaphoreSlim _semaphore = new(1);
2727
private readonly ILogger<ResourceEventQueue<TEntity>> _logger;
2828
private readonly IKubernetesClient _client;
2929
private readonly IResourceCache<TEntity> _cache;
@@ -32,8 +32,7 @@ internal class ResourceEventQueue<TEntity> : IResourceEventQueue<TEntity>
3232
private readonly IDictionary<string, ResourceTimer<TEntity>> _delayedEnqueue =
3333
new ConcurrentDictionary<string, ResourceTimer<TEntity>>();
3434

35-
private readonly ConcurrentDictionary<string, ExponentialBackoffHandler> _errorHandlers =
36-
new ConcurrentDictionary<string, ExponentialBackoffHandler>();
35+
private readonly ConcurrentDictionary<string, ExponentialBackoffHandler> _errorHandlers = new();
3736

3837
private readonly ResourceEventQueueMetrics<TEntity> _metrics;
3938

0 commit comments

Comments
 (0)