i.e. in PHP, you can build a library of your methods in one file, and error is only given, if there are problems in execution (not in compiler). I wonder if something like that is possible in C#, for example, I could put dedicated methods for both .NET 3.5 and 4.5 in same file:
//myFile.cs
public void mymethod_for_v35(object profile)
public async void mymethod_for_v45(dynamic profile)
so, I could include myfile.cs in all projects (whether targeting 3.5 or 4.5) and when I am targeting 3.5, in application I will only call first method . However, as 2nd method is for 4.5 (and 3.5 net compilers dont understand that), we still get compilation errors in IDE.
Does there exist any workaround or Flag, to allow the existence of that method (even though it's unsupported in current .NET version of project) ?
async/awaitis definitely one of those, as isdynamic. You can have one code base (with either conditional compilation or conditional includes in the project file), but having one binary is not a realistic goal in this case.