Home > database >  Is VB.NET really better than C# for Office Interop?
Is VB.NET really better than C# for Office Interop?

Time:10-23

While looking for an example how to open an Excel file with Excel Interop I stumbled upon this answer where the author writes the following under a piece of code that uses the Workbooks.Open method:

[..], this stuff is much easier if you use VB.NET. [..]. VB.NET does option parameters well, C# does not, hence the Type.Missing.

I compared this method in VB.NET and C# in a solution with two projects and they are identical. Do I miss something or is it correct that they have the same signature with a bunch of Object typed parameters?

CodePudding user response:

There is no big difference between the two because they are used to generate the IL code. Only the difference in the generated IL code makes any sense. They both provide almost the same language features and don't have so much better nuances. If you are familiar with one of them go with it and don't listen to anybody. Both programming languages are popular for automating Office applications. VB.NET is very convenient to chose who migrates Office solutions written in VBA, C# is popular between other .Net developers who requires automating Office or creating a COM add-in.

I personally used both programming languages a lot for Office solutions and didn't find any valuable pros and cons. Both are valid.

  • Related