Skip to content

Commit 74b996f

Browse files
Simplify some code
Use some modern C# features.
1 parent fa2b663 commit 74b996f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Grafana.OpenTelemetry.Base/GrafanaOpenTelemetryResourceDetector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public GrafanaOpenTelemetryResourceDetector(GrafanaOpenTelemetrySettings setting
2525

2626
public Resource Detect()
2727
{
28-
var attributes = new List<KeyValuePair<string, object>>(new KeyValuePair<string, object>[]
29-
{
28+
var attributes = new List<KeyValuePair<string, object>>(
29+
[
3030
new KeyValuePair<string, object>(ResourceKey_DistroName, ResourceValue_DistroName),
3131
new KeyValuePair<string, object>(ResourceKey_DistroVersion, GetDistroVersion()),
3232
new KeyValuePair<string, object>(ResourceKey_DeploymentEnvironment, _settings.DeploymentEnvironment)
33-
});
33+
]);
3434

3535
attributes.AddRange(_settings.ResourceAttributes);
3636

src/Grafana.OpenTelemetry.Base/ReflectionHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal static void CallStaticMethod(string assemblyName, string typeName, stri
1717
{
1818
var assembly = Assembly.Load(assemblyName);
1919
var type = assembly.GetType(typeName);
20-
var method = type.GetMethod(methodName, arguments.Select(obj => obj is null ? null : obj.GetType()).ToArray());
20+
var method = type.GetMethod(methodName, [.. arguments.Select(obj => obj?.GetType())]);
2121
method.Invoke(null, arguments);
2222
}
2323
}

0 commit comments

Comments
 (0)