.net 4.0 compatibility
i write winforms application, using .net 4.0, linq, etc. will it work on mac开发者_运维问答hines with .net 2.0?
No it will not. Applications compiled for Framework version 4.0 will require that framework to be present on the machine where the application will run.
If you use .NET 4 features then no, it won't work on .NET 2.
If you just want to use LINQ to Objects and no other newer features, then you should look into LINQBridge, which is a port of LINQ to Objects for .NET 2. You can then make Visual Studio target .NET 2 in your project properties, use the LINQBridge libraries, and your app should then work on a .NET 2 machine.
Note that you will still be able to use a lot of the features from C# 3 and 4, such as lambda expressions (but not expression trees), automatically implemented properties, anonymous types, optional parameters and named arguments etc. Obviously not everything will be available though - dynamic
won't work on .NET 2 for example.
精彩评论