Closed RealDotNetDave closed 1 year ago
I'd say it's high-time to use it then ;)
Could you supply a sample of what you mean, including what should be generated? Also a link to the CS…
violation would be helpful, I haven't heard of that one.
Here is the link:https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1819 It does say it should return a copy.
for example, this field:
private byte[] _rowVersion;
According to CA1819, it should be changed to a method or the Collection
type or a copy.
Thanks for sharing the link! That CA rule is about properties, not fields. But let's take your example as a property, so
private byte[] _rowVersion;
public byte[] RowVersion => _rowVersion;
Then CA1819 would be raised by the property. Are you proposing an attribute placed on _rowVersion
which would cause RowVersion
to be generated in a way that would not cause CA1819 to be raised?
Closing due to inactivity. Feel free to reopen.
I haven't used this library yet, but I thought of something that could be very useful. There is a code violation thrown when properties return collections. This violation states that properties that return collections should return a copy/ clone of that collection.
It would be a great addition to this package to auto-generate properties that automatically return a copy/ clone of the collection from a private field.