OT: Difficulty in transitioning from VB to C#?

  • Thread starter Thread starter Rich Wallace
  • Start date Start date
R

Rich Wallace

Hi all,

I've been doing VB for about 4 years (VB6 and VB.NET). How difficult is it
make a transition or to learn C# if I've been using .NET for 2 years?

TIA
-Rich
 
not that hard if you know some C++, classes are all the same, structure is
the same, just the syntax changed
 
I've never seen C++ at all, I've been looking over C# code and I can read it
enough to understand what's going on, but sitting and writing it is a
different story
 
Hi Rich,

I asked that because than you had almost the way it is used, now your big
trouble will not be the framework but things as the case sensitive and
always setting that useless semicolon at the end.

I am always saying that vb.net and C# are just the cement to build something
with the framework.

It should not be that difficult I assume. Mostly it written in this
newsgroup with this questions, that it takes 2 weeks for a good VB.net
programmer to learn C#. Maybe because you are not used to those two
disadvantages something longer.

Just my thought,


Cor
 
I made the transition recently and it wasn't too bad. Within one
week, it was feeling very natural. And C# is much cleaner than VB.

One thing I found useful (in addition to these forums) is a good VB to
C# converter. Instant C# was the best one I found, but there are a
few out there.
 
Rich Wallace said:
Hi all,

I've been doing VB for about 4 years (VB6 and VB.NET). How difficult is it
make a transition or to learn C# if I've been using .NET for 2 years?

Rich,

If you happen to be a poor typist and are used to having the IDE help
you here, forget it for the current version of C#. I am doing some
work in C# and complaining constantly after several years of being
spoiled by the VB and VB.NET IDE.

That said it really isn't too bad once you get used to the odd syntax
;)

The .NET framework is the real magic here because you already know it
from the VB.NET work, so C# actually feels pretty natural as soon as
you get the structure down.

Best of luck,
Charlie
 
Rich Wallace said:

I'm new to .NET and a book I'm working through gives examples in both VB.NET
and C#.
C# looks pretty simple to pick up especially if you have ever worked with
JavaScript or looked at Java.
There are a few differences between vb.net and C# though namely....
C# is case sensitive.
Variable types go before variable names.
Each line must end in a semi-colon.
No subs... use the void keyword instead to denote that a function returns
nothing.
"Imports" becomes "using"
"Me.xxx" becomes "This.xxx"
The keyword "inherits" isn't used in a class declaration.
That's some syntax/logic differences that spring to mind.
Oh yep another one..... destructs are coded in C# by placing a tilde (~)
before the object name as opposed to setting the object to "Nothing"

Cheers
Jay
 
I don't mean to scare you, but here's some of the more sinister
differences (and why a converter is useful):

- VB's "Not" is not easily replaced by the C# "!" operator since the
precedence levels are totally different (VB's "Not" has much lower

operator precedence than C#'s "!").

- VB has many different 'styles' of array declaration and event
handling
setup, while C# is .. well .. elegant.

- Is, TypeOf and GetType keywords have subtly different misleading
meanings (x Is y becomes x == y, TypeOf x Is y becomes x is y,
GetType(x) becomes typeof(x), but .GetType() stays .GetType() ....

aaahhhhh!!!!).

- Web form initialization is curiously different (VB uses "Page_Init"
to
handle the base class "Init" event, while C# overrides the base
class "OnInit" method).

- C# has no elegant way to increase the size of a plain vanilla array
(4
lines are necessary - work it out yourself...).

- VB allows "Option Strict Off" and late binding, which increases the

complexity of VB to C# conversion by an order of magnitude.

- VB allows you to assign return values to a method (via "MethodName =

x" statements) anytime before leaving the method. Converting this
mess to a modern language "return" syntax is a barrel of laughs.

- VB's "Select" statement and C#'s "switch" statement seem similar
until
you try converting just one (C#'s "switch" is only good for about
5% of
the cases where you'd use VB's extremely versatile "Select").
 
Back
Top