I have Visual Studio 2012 and have my target framework set to .NET 2.0.
But I have:
ThreadPool.QueueUserWorkItem(example => Threadedmethod(intval,classVal) );
void Threadedmethod(int id, MyClass val)
{ .... }
and it compiles.
How can I tell if this will work from VS2012? I have been told the =>
operator is not compatible with .NET 2.0.
I think you're confused with .net
version and c#
version. When you target to .Net 2.0, you can still use c#(language features) like lambda, extension methods, collection initializer, object initializer etc.
This has nothing to do with the .Net version. Thing is you can't use classes which are newly added in .Net version > your target version.
Keep in mind that when it gets compiled your code is perfectly valid and it will run properly in machine with only .Net framework 2.0.
I have been told => is not valid in .net 2.0
It is wrong, correct statement would be is not valid in c# 2.0 but you're not using c# 2.0 in VS2012. It is c# 5.0 compiler you use there.
For more information read Jon's article especially Using C# 3 in .NET 2.0 and 3.0 part.
My conclusion: Your application will work perfectly in .Net 2.0 without any doubt.