Skip to content

Commit 494e6b2

Browse files
Use Property Id and use default value properly
1 parent bd69469 commit 494e6b2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/System.CommandLine.Subsystems/Subsystems/Annotations/AnnotationAccessor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ public struct AnnotationAccessor<TValue>(CliSubsystem owner, AnnotationId<TValue
1313
/// <summary>
1414
/// The ID of the annotation
1515
/// </summary>
16-
public AnnotationId<TValue> Id { get; }
17-
public readonly void Set(CliSymbol symbol, TValue value) => owner.SetAnnotation(symbol, id, value);
18-
public readonly bool TryGet(CliSymbol symbol, [NotNullWhen(true)] out TValue? value) => owner.TryGetAnnotation(symbol, id, out value);
16+
public AnnotationId<TValue> Id { get; } = id;
17+
public readonly void Set(CliSymbol symbol, TValue value) => owner.SetAnnotation(symbol, Id, value);
18+
public readonly bool TryGet(CliSymbol symbol, [NotNullWhen(true)] out TValue? value) => owner.TryGetAnnotation(symbol, Id, out value);
1919
public readonly TValue? Get(CliSymbol symbol)
2020
{
2121
if (TryGet(symbol, out var value))
2222
{
23-
return value ?? defaultValue;
23+
return value;
2424
}
2525
return defaultValue;
2626
}

0 commit comments

Comments
 (0)