开发者

Framework 4, ASP.NET Web Site, IsNullOrWhiteSpace not defined

I have a ASP.NET Web Page using Framework 4 and I just realized that IsNullOrWhiteSpace existed in Framework 4, I know I'm slow. Anyway, I changed all my I开发者_Python百科sNullOrEmpty to IsNullOrWhiteSpace, since I was having to, if !String.IsNullOrEmpty then trim, and check length, which was insain, but the only way to actually make sure it wasn't empty. So I was quite happy to see this new method. However, in my classes behind my aspx pages, I can use IsNullOrWhiteSpace, but the other common classes that do not have pages, I get this error.

Error 12 string does not contain a definition for IsNullOrWhiteSpace

Same project, same namespace, not the same results..

Need answers, Mr Confused


are your other common classes in a different project and if so look at properties and make sure it's set to .net 4.0.


Make sure that you're targeting the 4.0 version of the framework in the compilation of your aspx pages. Try putting an explicit compilation element in your web.config, under the system.web tag and see if it works:

<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜