RedundantExplicitArraySize: I don't agree it is redundant as it enforces the array size
Answered
Setting the array size explicitly makes sure that the number of items you include in the initializer is exactly that at compile time. If you include more or less items than the explicit size specified you get a compile time error. I consider this very helpful and useful to avoid mistakes when the developer is not being careful enough.
I also like to use array initialization without specifying the size explicitly in cases where the length is variable but when the length must be fixed I encourage everyone to specify the array size explicitly.
I would advise to change the name of this inspection to something like "ExplicitArraySizeIsEnforced".
Please sign in to leave a comment.
Hello Alvaro,
You may disable such inspections via ReSharper | Options | Code Inspection | Inspection Severity or directly in code editor: Alt+Enter on an inspection | "Inspection ... " | Configure inspection severity | Do not show.
Thanks!
Thanks for your reply however I already did that but I was just trying to be proper and help other developers as I consider the inspection is a bit misleading.