简体   繁体   中英

ReSharper giving C# 3.0 Code Inspection Warnings to .NET 2.0 Projects

当我使用最新版本的ReSharper(4.1)在.NET 2.0项目中工作时,我收到有关使用var关键字和lambadas等的警告。任何想法我怎么能只为.NET 2.0项目禁用它?

Indeed, you can use C# 3.0 compiler features when targeting .NET 2.0, except extension methods and default LINQ implementations, which are located in newer assemblies. But if you need to co-operate with VS2005 users, you can open Properties view for a given project (not Project Properties, but Edit \\ Properties Window, or F4) and select desired language level.

You can actually use var in 2.0 projects. It's syntactical sugar and the compiler works with it. Check out this for more info.

http://weblogs.asp.net/shahar/archive/2008/01/23/use-c-3-features-from-c-2-and-net-2-0-code.aspx

Daniel Moth has a great blog post on how to using C# 3.0 features (including extension methods) in .Net 2.0.

After rereading the question, this really doesn't help. You can turn off specific inspections via the R# Options window. I don't know of a way to switch back and forth between 2.0 and 3.5 project settings without manually changing them :S.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM