2 ms·
I think you would want to use an init only property for your example class Test { public string Test { get; init; } } I'm not a C# expert thou
by vips7L 11mo ago
I think you would want to use an init only property for your example
class Test {
public string Test { get; init; }
}
I'm not a C# expert though, and there seems to be many ways to do the same thing.
- bilekas 11mo agoI don't use the init decorator myself but I would hazard a guess it's similar. Don't quote me on that though. The point does stand though, outside of modifying properties I'm not sure what a "private" class itself achieves.
- vips7L 11mo ago> I don't use the init decorator myself but I would hazard a guess it's similar. Genuinely curious, why not? Seems to be less verbose. I don’t write C#s so I’m not sure of the downsides of any particular feature.