开发者

Going from C# to VB.NET - Resources?

开发者 https://www.devze.com 2023-01-30 23:56 出处:网络
Though I have worked with Visual Basic in the past (VB 4, 5, and 6), ever since the .NET framework was first released I have been working in C#. For an开发者_开发百科 upcoming project I am being asked

Though I have worked with Visual Basic in the past (VB 4, 5, and 6), ever since the .NET framework was first released I have been working in C#. For an开发者_开发百科 upcoming project I am being asked to work in VB.NET so I am trying to come up to speed with VB.NET. Can anyone recommend any resources (books, articles, etc ..) targeted towards C# developers who are looking to quickly become familiar with VB.NET?

EDIT: I feel I should emphasize, due to certain comments, that I am not trying to compare the various worth of each language (C# vs. VB.NET). Such a comparison wold be subjective in so many ways. Rather, I am saying I myself am not that versed in VB.NET and am looking for resources that would enable me to learn VB.NET considering my experience is with C#.


Never, ever forget this when you're doing boolean logic:

AndAlso instead of And

OrElse instead of Or


Just dive in. Seriously, that is the best way to learn. Functionally, they are mostly the same these days.

For me, the major differences are

  • lack of support for iterators (yield return) in VB.Net (coming in the next version)
  • XML literals in VB.Net are not available in C#. As a C# developer, many times I prefer VB when working with XML these days...
  • linq query syntax behaves differently in VB (richer at first sight in VB, but much more consistent in C#)

Other than that, it's mostly just syntax

Oh, and don't forget to put Option Strict and Option Infer on... If you need dynamic, you can 'sort of' get the same by turning off Option Strict (I recommend doing this at the file level).


Here is a link that compares the two languages: http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

In truth with .Net 4.0 they are pretty much the same. The syntax is different (obviously), but their functionality is nearly identical. This is now by design, Microsoft plans on co-evolving them from now on, so new features will be added to both.


I work with both, if you know C# and know VB6 syntax, it'll be easy to pick up (I started with C# since I have more of a C++ background, but I also had some VB6 so it was very easy to start working on VB.Net as well).

There's a few things you'll have to look up every now and then but as Kevin says, they're more or less the same language. And anyway, the languages themselves aren't that big so aren't very difficult to learn, it's learning the .Net Framework that takes a lot of time, so you know what's already written and where to find it, and your knowledge of that transfers across.


go to msdn Visual Basic Developer Ceneter , you'll find tons of information there

http://msdn.microsoft.com/en-us/vbasic/default

here is a learning guide

http://searchwindevelopment.techtarget.com/tutorial/Choosing-VBNET-or-C-Learning-Guide


Google is good for checking syntax differences (search "C# keyword equivalent in vb.net"). MSDN is good about having code examples in both VB and C# too.

This online conversion tool can often be helpful too.


Besides the short circuit operators, one thing that can trip you up is not initializing your variables. It seems like you don't have to, but if you are in a loop you actually do have to.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号