Skip to content

Commit fc22884

Browse files
committed
refactor and fix warning
1 parent 0e6a56a commit fc22884

File tree

1 file changed

+10
-6
lines changed
  • src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi

1 file changed

+10
-6
lines changed

src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AssemblyExtensions.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ public static class AssemblyExtensions {
1515
#endif
1616
public static TValue GetAssemblyMetadataAttributeValue<TAssemblyMetadataAttribute, TValue>(this Assembly assm)
1717
where TAssemblyMetadataAttribute : Attribute
18-
=> (TValue)(
19-
(assm ?? throw new ArgumentNullException(nameof(assm)))
20-
?.GetCustomAttributesData()
21-
?.FirstOrDefault(static d => ROCType.FullNameEquals(typeof(TAssemblyMetadataAttribute), d.AttributeType))
18+
=> (TValue)GetAssemblyMetadataAttributeValue<TAssemblyMetadataAttribute>(
19+
assm ?? throw new ArgumentNullException(nameof(assm))
20+
)!;
21+
22+
private static object? GetAssemblyMetadataAttributeValue<TAssemblyMetadataAttribute>(Assembly assm)
23+
where TAssemblyMetadataAttribute : Attribute
24+
=> assm
25+
.GetCustomAttributesData()
26+
.FirstOrDefault(static d => ROCType.FullNameEquals(typeof(TAssemblyMetadataAttribute), d.AttributeType))
2227
?.ConstructorArguments
2328
?.FirstOrDefault()
24-
.Value
25-
)!;
29+
.Value;
2630
}

0 commit comments

Comments
 (0)