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

Extend partial to properties to make Source Generators more useful #3600

Closed
b-straub opened this issue Jun 9, 2020 · 2 comments
Closed

Extend partial to properties to make Source Generators more useful #3600

b-straub opened this issue Jun 9, 2020 · 2 comments

Comments

@b-straub
Copy link

b-straub commented Jun 9, 2020

Version Used:

VS 16.7 P2

Championed issue: #3301
Draft spec: #3417

With the introduction of SG a nice field to work on is the generation of properties with special skills, similar to the SWIFT PropertyWrappers. Currently a straightforward implementation is handicapped by the missing possiblity to use partial properties. To workaround an abstract helper class with abstract properties, or attributed private fields (see AutoNotifyGenerator) must be used. Both solutions are not very comfortable and concise.

With partial properties the sample would look much cleaner:

[AutoNotify]
public partial class ExampleViewModel
{
   public partial string Text { get; set; }
   public partial int Count { get; set; }
}

A working example SG using an abstract template class can be found here: ObservableTests. With partial properties the code would be way more concise.

@jaredpar
Copy link
Member

This is a language request hence moving to csharplang.

@jaredpar jaredpar transferred this issue from dotnet/roslyn Jun 22, 2020
@333fred
Copy link
Member

333fred commented Jun 22, 2020

Closing as a duplicate of #3412.

@333fred 333fred closed this as completed Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants