Skip to content

Commit 1a751ed

Browse files
Update enrichers to use the new compound-assignment operator
1 parent 288fb9d commit 1a751ed

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/Serilog.Enrichers.ExcelDna/Enrichers/ExcelDna/ExcelBitnessEnricher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public class ExcelBitnessEnricher : ILogEventEnricher
3535
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
3636
{
3737
var cachedProperty =
38-
_cachedProperty =
39-
_cachedProperty ?? propertyFactory.CreateProperty(ExcelBitnessPropertyName, GetExcelBitnessInfo());
38+
_cachedProperty ??= propertyFactory.CreateProperty(ExcelBitnessPropertyName, GetExcelBitnessInfo());
4039

4140
logEvent.AddPropertyIfAbsent(cachedProperty);
4241
}

src/Serilog.Enrichers.ExcelDna/Enrichers/ExcelDna/ExcelVersionEnricher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class ExcelVersionEnricher : ILogEventEnricher
3434
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
3535
{
3636
var cachedProperty =
37-
_cachedProperty =
38-
_cachedProperty ?? propertyFactory.CreateProperty(ExcelVersionPropertyName, ExcelDnaUtil.ExcelVersion);
37+
_cachedProperty ??= propertyFactory.CreateProperty(ExcelVersionPropertyName, ExcelDnaUtil.ExcelVersion);
3938

4039
logEvent.AddPropertyIfAbsent(cachedProperty);
4140
}

src/Serilog.Enrichers.ExcelDna/Enrichers/ExcelDna/ExcelVersionNameEnricher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public ExcelVersionNameEnricher(bool includeExcelBitness = true)
4646
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
4747
{
4848
var cachedProperty =
49-
_cachedProperty =
50-
_cachedProperty ?? propertyFactory.CreateProperty(ExcelVersionNamePropertyName, GetExcelVersionName(_includeExcelBitness));
49+
_cachedProperty ??= propertyFactory.CreateProperty(ExcelVersionNamePropertyName, GetExcelVersionName(_includeExcelBitness));
5150

5251
logEvent.AddPropertyIfAbsent(cachedProperty);
5352
}

src/Serilog.Enrichers.ExcelDna/Enrichers/ExcelDna/XllPathEnricher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class XllPathEnricher : ILogEventEnricher
3434
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
3535
{
3636
var cachedProperty =
37-
_cachedProperty =
38-
_cachedProperty ?? propertyFactory.CreateProperty(XllPathPropertyName, ExcelDnaUtil.XllPath);
37+
_cachedProperty ??= propertyFactory.CreateProperty(XllPathPropertyName, ExcelDnaUtil.XllPath);
3938

4039
logEvent.AddPropertyIfAbsent(cachedProperty);
4140
}

0 commit comments

Comments
 (0)