If I have the following class:
public class Foo
{
public string Code { get; set; }
public string Description { get; set; }
public DateTime? EffectiveDate { get; set; }
}
and I want to quickly convert it to a record
type:
public record Foo(string Code, string Description, DateTime? EffectiveDate);
Is there a way to do that quickly? the built-in quick actions menu in VS19 doesn't seem to offer this.
dotnet developers are working on that according to this issue classtorecode
You can try "Convert to positional record" in VS 2022 after clicking the class and then the screwdriver on the left.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With