I ran a Code Analysis and got this message:
Warning 5 CA1822 :
Microsoft.Performance : The ‘this’
parameter (or ‘Me’ in Visual Basic) of
‘MainForm.CheckFileIfFileIsInUse(String)’
is never used. Mark the member as
static (or Shared in Visual Basic) or
use ‘this’/’Me’ in the method body or
at least one property accessor, if
appropriate. D:\WORK\Update\Update\MainForm.vb
I’m not sure I understand it. This is the line it’s referring to:
Dim testfile As String = thefilename & ".tst"
It’s saying that it is never used but in the very next line I have this:
If IO.File.Exists(testfile) Then
IO.File.Delete(testfile)
End If
So I know it’s being used. I have this same message in two places I don’t get why it’s saying it’s never used.
Help a confused newbie find his way 😛
Thanks as usual,
Eroc
It’s simply showing you the first line of the method – the contents of that line is unimportant. The point is that the method doesn’t use the
Mereference anywhere, so you can declare it to be aSharedmethod instead.In other words, instead of:
Have: