I'm wanting to pick up ArcObjects and have decided on C# over VB as my language. I know that arcpy uses python version 2.7. If I had started learning python 3.2 to learn arcpy I'm sure I would have had issues. I don't want to have any extra issues learning C#. Which version of C# should I learn?
2 Answers
ESRI recommends to use the Microsoft .NET Framework 3.5 Service Pack 1 for version 10 and higher:
So as you can see in this post What are the correct version numbers for C#? you should learn C# 3.0.
They also have instructions for using .NET 4.0 or 4.5 if you wish to take advantage of the new language features:
.NET 4.0 and 4.5 support for ArcGIS 10.2 Desktop and Engine developers
The only change you need to make is to edit ArcMap.exe.config (or the relevant .exe.config for the application you are extending) and changing:
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
to:
<startup>
<supportedRuntime version="v4.0.30319"/>
</startup>
This causes ArcMap to load the v4 runtime, which directly supports .NET 4.0 and 4.5 assemblies and also allows the v2 runtime to load side-by-side for .NET 3.5 and earlier assemblies.
However, as Katah says, ESRI recommend using .NET 3.5 for add-ins. At least one reason for this is that add-ins do not require a setup program to install them and so there is not necessarily a way to verify that .NET 4 or 4.5 is installed and that ArcMap is configured to use it when distributing your add-in.