Differences Between VB and C#
Other than the obvious syntax differences
between VB and C#, there are some important differences in the
features between the two languages:
- C# allows 'unsafe' code, or pointer manipulation.
- C# allows assignments embedded in expressions (e.g., if ((x = y.Value) == 2)).
- C# has anonymous methods and a more flexible lambda operator, but VB10 and above includes complete
equivalents for all C# lambda scenarios.
- C# has the useful conditional ternary operator (?:). The VB
IIf function is not a good substitute since the arguments
must all be evaluated, but VB9 and above has the If ternary
operator which has identical behavior to the C# operator.
- VB allows methods with optional parameters, but C#4 and above includes this feature.
- VB allows using named parameters when calling methods, but C#4 and above includes this feature.
- VB allows types within interfaces.
- VB has the very flexible Select construct (much more flexible than the C# switch).
- VB has the When filter for catch block headers, but C# 2015 and above includes a when operator.
- VB has a special intuitive syntax for XML literals.
- VB allows late binding, but C#4 and above has the dynamic keyword which also allows late binding.
If you need to convert between VB and C# and
you are depending on the results being reliable and accurate, then
you will want to have
Instant C#, the best VB to C# converter, or
Instant VB, the best C# to VB converter, at your fingertips.
Copyright © 1997 - 2017 Tangible Software Solutions Inc.