Closed grzegorzorwat closed 1 year ago
I removed IsReadOnly
property because it was merged after last release so it shouldn't be breaking change. If you think it should remain, please let me know and I will restore it and make it return value from new Writablity property.
this looks good to me, thank you very much @grzegorzorwat
PR resolves #163. Adds checks for init setter in properties and immutability in classes.
It works with init setters from C# 8 and records from C# 9, even with ArchUnitNET targieting .net standard 2.0, which only supports C# 7, because those features are only syntactic sugar.
I didn't want to include IsImmutable in Member. Instead, I wanted to add predicates that would check if Member is readonly or has an init setter, and I wanted to use that predicate on all classes' members to see if they are immutable at the class level. However, I couldn't figure out how to combine class and member predicates, so I ended up with IsImmutable in Member.