allow "with" to be used with regular classes and structs #7752
-
//mySuperModel - object of class or struct
//SomeValue - public for setting property or field now: if(...)
{
mySuperModel.SomeValue = 50;
return mySuperModel;
//mySuperModel (with SomeValue == 50) will returns
} after: if(...) return mySuperModel with { SomeValue = 50 };
//mySuperModel (with SomeValue == 50) will returns.
//saving up to four lines of code |
Beta Was this translation helpful? Give feedback.
Answered by
DavidArno
Dec 8, 2023
Replies: 1 comment
-
See #162. There seemed willingness within the language team to extend "withers" to work with non-record types five years ago. Unfortunately, there's not been any obvious signs of progress since as all that's really happened is the feature has been repeatedly pushed back in terms of release target and now just sits on the backlog. So this one resides in the "it might happen, one day" category. Making some noise on that other thread might help get things moving. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Lavshyak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #162. There seemed willingness within the language team to extend "withers" to work with non-record types five years ago. Unfortunately, there's not been any obvious signs of progress since as all that's really happened is the feature has been repeatedly pushed back in terms of release target and now just sits on the backlog. So this one resides in the "it might happen, one day" category.
Making some noise on that other thread might help get things moving.