A couple of years ago programmers wrote an application in C#3.0. Recently we decided to reuse these code and try to plug it into a .net Windows applications in C# 2.0. Is it feasible to do this?
Thank you for any info you provide?
Sean
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jun 27, 2012, 6:49 PM
If the application made heavy use of these features (notably LINQ), then it will probably be impractical to translate it to C# 2.0 and the only sensible option would be to start again.
Apart from that, a translation should be feasible as C# 3.0 is backwards compatible with C# 2.0.
For a list of the stuff that was introduced in C# 3.0, see here:
http://msdn.microsoft.com/en-us/library/bb308966.aspx
VulpesPosted Jun 29, 2012, 6:43 PM
For example:
Implicitly typed variables - just replace 'var' with the actual type.
Lambda expressions - replace with anonymous methods which were introduced in C# 2.0.
Object and collection initializers - should be simple to rewrite.
However, anything to do with LINQ (to objects, XML or SQL) will need to be rewritten using 'traditional' code - there's no other way.
sean liPosted Jun 29, 2012, 4:27 PM