.net 4.0 - C# Extension Method Not Defined -


i have basic extension method:

namespace phpimport {     public static class stringextensionmethods     {         public static bool isnullemptyorwhitespace(this string thestring)         {             string trimmed = thestring.trim();              if (trimmed == "\0")                 return true;              if (thestring != null)             {                 foreach (char c in thestring)                 {                     if (char.iswhitespace(c) == false)                         return false;                 }             }              return true;         }     } } 

i'm trying use in same project (separate .cs file), in same namespace, , i'm getting 'string' not contain definition 'isnullemptyorwhitespace' error.

namespace phpimport {     class aclassname: aninterface     {         private void somemethod()         {              if (string.isnullemptyorwhitespace(astringobject)) { ... }         }     } } 

i've tried rebuilding/cleaning solution, , restarting visual studio no avail.

any ideas?

since made extension method, need call as:

if (astringobject.isnullemptyorwhitespace()) 

it "extends" usage onto string instances, doesn't add new static methods string class, suggested current call syntax.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -