Skip to content

Commit 70cb7df

Browse files
committed
Make ReferenceItem consistent with other snapshot types
1 parent 755c7cd commit 70cb7df

File tree

1 file changed

+7
-12
lines changed
  • src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/PackageRestore/Snapshots

1 file changed

+7
-12
lines changed

src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/PackageRestore/Snapshots/ReferenceItem.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,22 @@ namespace Microsoft.VisualStudio.ProjectSystem.PackageRestore;
99
/// Represents a reference item involved in package restore, with its associated metadata.
1010
/// </summary>
1111
[DebuggerDisplay("Name = {Name}")]
12-
internal sealed class ReferenceItem : IRestoreState<ReferenceItem>
12+
internal sealed class ReferenceItem(
13+
string name,
14+
IImmutableDictionary<string, string> metadata)
15+
: IRestoreState<ReferenceItem>
1316
{
14-
// If additional state is added to this class, please update RestoreHasher
15-
16-
public ReferenceItem(string name, IImmutableDictionary<string, string> metadata)
17-
{
18-
Requires.NotNullOrEmpty(name);
19-
20-
Name = name;
21-
Metadata = metadata;
22-
}
17+
// IMPORTANT: If additional state is added, update AddToHash and DescribeChanges below.
2318

2419
/// <summary>
2520
/// Gets the name (item spec) of the reference.
2621
/// </summary>
27-
public string Name { get; }
22+
public string Name { get; } = name;
2823

2924
/// <summary>
3025
/// Gets the name/value pair metadata associated with the reference.
3126
/// </summary>
32-
public IImmutableDictionary<string, string> Metadata { get; }
27+
public IImmutableDictionary<string, string> Metadata { get; } = metadata;
3328

3429
public void AddToHash(IncrementalHasher hasher)
3530
{

0 commit comments

Comments
 (0)