I've got the Warning :
Microsoft.Perfo rmance : The 'this' parameter of '....' is never used.Mark the member as static or use this in the method body or at least one prperty accessor, if appropriate.
to this code:
class CallFile
{
public String FindFile(string path)
{
try
{
XmlDocument ProjectFile = new XmlDocument();
ProjectFile.Loa d(path);
XmlNamespaceMan ager nsManager = new XmlNamespaceMan ager
(ProjectFile.Na meTable);
nsManager.AddNa mespace
("ns", "http://schemas.microso ft.com/developer/msbuild/2003");
String Wert = ProjectFile.Sel ectSingleNode
("/ns:Project/ns:PropertyGrou p/ns:ProductVersi on",nsManager). InnerText;
Console.Write(W ert + Environment.New Line );
return Wert;
}//try
finally
{
Console.WriteLi ne("");
}//finally
}//Method
}
But when I try to solve the warning and make the method static I get following error:
Memeber '.......' cannot be accessed with an instance reference, qualify it with a type name instad
Can anyone please explain me, how I could solve error and warning?
Microsoft.Perfo rmance : The 'this' parameter of '....' is never used.Mark the member as static or use this in the method body or at least one prperty accessor, if appropriate.
to this code:
class CallFile
{
public String FindFile(string path)
{
try
{
XmlDocument ProjectFile = new XmlDocument();
ProjectFile.Loa d(path);
XmlNamespaceMan ager nsManager = new XmlNamespaceMan ager
(ProjectFile.Na meTable);
nsManager.AddNa mespace
("ns", "http://schemas.microso ft.com/developer/msbuild/2003");
String Wert = ProjectFile.Sel ectSingleNode
("/ns:Project/ns:PropertyGrou p/ns:ProductVersi on",nsManager). InnerText;
Console.Write(W ert + Environment.New Line );
return Wert;
}//try
finally
{
Console.WriteLi ne("");
}//finally
}//Method
}
But when I try to solve the warning and make the method static I get following error:
Memeber '.......' cannot be accessed with an instance reference, qualify it with a type name instad
Can anyone please explain me, how I could solve error and warning?
Comment