I have a problem with my code posted below, set and get methods. I want to call it like this this.LastError.Set(1);
But it gives me this error: ‘int’ does not contain a definition for ‘Set’ and no extension method ‘Set’ accepting a first argument of type ‘int’ could be found (are you missing a using directive or an assembly reference?)
public class MyClass
{
private int ERROR_NUM = 0;
public int LastError
{
get { return ERROR_NUM; }
set { ERROR_NUM = value; }
}
bool IsLoaded()
{
int count = Process.GetProcessesByName("AppName").Length;
if (count == 1) return true;
if (count > 1) this.LastError.Set(1);
return false;
}
}
I know this is probably a dumb question so sorry for that, I’ve been fighting with this thing for a couple hours now and I’ve even gone so far as to try and give the LastError its own class. This is my first day on C#.
Just set it.