[RESOLVED] static method problem
Hi there,
I am doing an ASPX site with c# as the code behind. I haven't done this in a while but I needed to create a static class to check some variables - I stole this little bit of code of the net but I am having a problem.
This is the class.
Code:
public static class QueryStringCheck
{
public static bool HasValue(object o)
{
if (o == null)
{
return false;
}
if (o == System.DBNull.Value)
{
return false;
}
if (o is String)
{
if (((String)o).Trim() == String.Empty)
{
return false;
}
}
return true;
}
}
This is the code I am calling to make use of it...
Code:
if(!QueryStringCheck.Equals((object)Request.QueryString["TransactionId"]))
{
Response.Redirect("/MyAccount/PurchaseHistory.aspx");
}
But I get the error message
Error 12 An object reference is required for the nonstatic field, method, or property 'object.Equals(object)'
Now I remember going over this in school but it isn't like I can ever remember needing a static method (well having to create one myself - use ehm all the time)
Can anyone point out what I am missing - I just re-read some material on the subject but it didn't seem to help? I don't see anything wrong.
Thanks
Re: static method problem
Two things -
One, call the right method
Two, the string doesn't need to be cast as an object...
Duh for me!!!!