Request for a Roll-back to previous C# version analyzer #49437
Replies: 4 comments 4 replies
-
Not an analyzer, but if your main focus is education and intrigue you can basically get this with SharpLab's C# decompilation mode. If you want more granular application of C# features you can use ILSpy (which is what SharpLab is using on the backend, but it exposes more configuration.) |
Beta Was this translation helpful? Give feedback.
-
Convert to full property? |
Beta Was this translation helpful? Give feedback.
-
I don't think this fits into Roslyn itself. It seems like it might be a good community project. |
Beta Was this translation helpful? Give feedback.
-
I don't understand what is the goal here; why do you want to rollback the code to how it would look in a previous version of the language? If it's about education, then, as mentioned, ILSpy is a decent (though not perfect) approach. If it's about being able to modify your code in a way that can only be done in the older version of the syntax ("I want to multiply my setter with pi"), then language versions are irrelevant, you're just looking for a refactoring. As mentioned, such refactorings already exist. And if they're not sufficient for your needs, or if one is missing, then I think you should open specific issue about a specific refactoring. |
Beta Was this translation helpful? Give feedback.
-
In general, some newer C# features include short forms expression of a longer piece of a code fragment or boiler-template. I am requesting a Roll-Back Code Version Analyzer that would allow that would expand the short form to it full code. It should automatically pick, the previous rollback C# language version ( C#?.0 ), since that's when the short form was started introduced. For example, a short form C#9.0 feature would be to rolled-back to C# 6.0 long version of the code. It be great to see it go back to c#1.0 but I would settle for C#4.0 as a start of the base C# version to begin with. But it would be really cool to see the that chain of decisions in reverse, reflected in code. I really think this would help developers to because it would readily surface the history of the design decisions of the language, which now you have to glean from forms and videos. Hope you all agree. Let's make this happen.
Take for example auto-property; where I would like to get expansion of
public string Name { get; set; } = "bunny"
hints and can replace back to
private string name = "bunny";
public string Name
{
get
{
return http://this.name;
}
set
{
http://this.name = value;
}
}
This would be a separate analyzer.
Beta Was this translation helpful? Give feedback.
All reactions