Select to view content in your preferred language

VB and C#, which one is better to develop a WPF project

2996
4
Jump to solution
08-28-2017 07:16 AM
sailiTang
Occasional Contributor

Hi,

   I just start to use ArcGIS Runtime SDK for .NET 100.1.0 to develop a WPF project. I am using Visual Studio 2015, but I found ArcGIS Runtime Application (WPF) template is under C# not VB when I created a new project. I am wondering if ArcGIS Runtime SDK prefers C# and it is better to use C# to develop a WPF project? But I also found some VB code samples when I searched some WPF samples. That means VB and C# are the same good at ArcGIS WPF development? In my previous work, I used VB more often than C#. I am afraid that some functions C# have but VB doesn't if I choose VB. For ArcGIS runtime API, C# and VB are the same, the only difference is language style, right?

Thanks.

Saili

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

There's no right or wrong. Both languages can do the same thing. You should code in the language that _you_ are the most productive in.

However there's a few things to consider :

1. You'll find way more resources, samples, blog posts and forum posts etc that uses C# than VB. 

2. Xamarin doesn't support VB.NET

3. We do tend to focus a little more on C# than VB when it comes to samples and templates (sorry). We don't have infinite resources and by far most of our customers use C#, so we put the effort were it matters to most. And every time we survey what our customers prefer, the VB tribe gets smaller and smaller.

The ArcGIS Runtime Team are mostly C# people too, so we tend to be better at helping with C# responses than VB.NET

On a more subjective / personal opinion: In contrast to Ted I find C# more readable to VB.NET, because there's less "fluff" around the actual code. Example:

   If myObj.CheckCondition Then

       '' some code

   End If

vs

   if (myObj.CheckCondition())
   {

       // some code

   }

I find the Then/End If and all the other verbose statements creates a lot of noise around the much more important logic. It also forces you to put () after a method and not on a property (VB doesn't care), which makes the code very clear whether you're calling a method or a property. But I know that's really just a matter of taste.

View solution in original post

0 Kudos
4 Replies
TedKowal
Honored Contributor

This is a loaded question....

Since I learned to program (self taught), it was with VB.  I find VB more readable than C# and can debug code much more quickly.  Others may say the opposite, guess it depends upon what you are more familiar with.

Personally,  I write almost everything in VB, however if I have a speed critical process, or creating a specific web service/handler I use C#.  As far as functions found in C# and VB --- there has been absolutely nothing I could do in either language. (pertaining to GIS)    However, in working within the system and having to interface with old structural engineering programs that run in DOS and old fortran.... VB can be quite challenging, whereas C# a bit easier. 

VB.Net has caught up in speed and screen rendering with C# significantly over the years.  

Personally, I would stick with what you are comfortable with, and learn the "Other" side as you go.  Translating code between them has improved significantly over the years.

my 2 cents!

0 Kudos
sailiTang
Occasional Contributor

Hi Ted,

Thank you so much for your answer. Thanks for sharing your experience. I may choose VB.

0 Kudos
dotMorten_esri
Esri Notable Contributor

There's no right or wrong. Both languages can do the same thing. You should code in the language that _you_ are the most productive in.

However there's a few things to consider :

1. You'll find way more resources, samples, blog posts and forum posts etc that uses C# than VB. 

2. Xamarin doesn't support VB.NET

3. We do tend to focus a little more on C# than VB when it comes to samples and templates (sorry). We don't have infinite resources and by far most of our customers use C#, so we put the effort were it matters to most. And every time we survey what our customers prefer, the VB tribe gets smaller and smaller.

The ArcGIS Runtime Team are mostly C# people too, so we tend to be better at helping with C# responses than VB.NET

On a more subjective / personal opinion: In contrast to Ted I find C# more readable to VB.NET, because there's less "fluff" around the actual code. Example:

   If myObj.CheckCondition Then

       '' some code

   End If

vs

   if (myObj.CheckCondition())
   {

       // some code

   }

I find the Then/End If and all the other verbose statements creates a lot of noise around the much more important logic. It also forces you to put () after a method and not on a property (VB doesn't care), which makes the code very clear whether you're calling a method or a property. But I know that's really just a matter of taste.

0 Kudos
sailiTang
Occasional Contributor

Hi Morten,

Thanks a lot for your good answer. Think about everything and I plan to use VB, because most of us here are more familiar with VB. Thanks for your help.

Saili

0 Kudos