I have a class that inherits from a base class and implements the following...
Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
Now the base class it inherits from also implements this System.IComparable.CompareTo so I'm getting the following compiler warning:
Warning: 'System.IComparable.CompareTo' is already implemented by the base class. Re-implementation of function assumed.
I'm fine with that so my question is how can I suppress this warning for just this function (i.e. not all such warnings).
Clarifications:
- Here is a link to the error on MSDN.
- I've already tried both Shadows and Overrides and neither eliminates the warning.
- The warning isn't on the method itself (unless Shadows or Overrides are omitted), but rather it's on "Implements System.IComparable.CompareTo" specifically.
- I am not looking to suppress all warnings of this type (if they crop up), just this one.
Solution:
I was hoping to use the System.Diagnostics.CodeAnalysis.SuppressMessage attribute or something like C#'s #pragma but looks like there's no way to suppress the warning for a single line. There is a way to turn this message off for this project though, without turning all warnings off.
I manually edited the .vbproj file and included 42015 in the node for Debug and Release compilations. Not ideal but better than always seeing the warning in the IDE.
If someone has a better solution please add it and I'll gladly try it flag the answer.