mathnet-spatial
mathnet-spatial copied to clipboard
Methods should be marked as pure
To reproduce:
Create a field like this:
private static readonly UnitVector3D DefaultDirection = new UnitVector3D(0, 1, 1);
If you then access it using
DefaultDirection.Negate()
you get a warning from VisualStudio/Resharper:
'Impure method is called for a readonly field of value type'
I guess the method is pure and therefore perhaps it would be possible to give a hint using the [Pure] attribute? https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.pureattribute(v=vs.110).aspx
There are a couple of [Pure] sprinkled in the code but they are sparse, sry about that.
I'm going to write a roslyn analyzer for this.