Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using field+auto-prop #76906

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 24, 2025
@@ -53,10 +50,11 @@ public static SolutionId CreateFromSerialized(Guid id, string debugName = null)
return new SolutionId(id, debugName);
}

internal string DebugName => _debugName;
[field: DataMember(Order = 1)]
internal string DebugName { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the property in front of the constructor.

@tmat
Copy link
Member

tmat commented Jan 24, 2025

I think the refactoring should move the property declaration to where the field declaration used to be if it's removing it. Or maybe we need to run follow up refactoring that groups data-backed members together.

Having (semi)auto-properties scattered across the type declaration makes it difficult to see what data the object holds onto, weather it has any mutable state, what the value of Order should be when you're adding another one with DataMember attribute, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants