473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

C# for VB.NET Programmers

Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method). I'm not looking to gripe or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.

Regards,
Scott McNair
Aug 23 '06 #1
13 4970
I developer mostly in VB, but I don't like the 'with' statement either. I've
also found it harder to read the code with the variable name missing. If I
use a variable a lot, I copy it, and paste it so I don't have to type it out
all the time. But for me, having the entire variable there, every time,
makes it far more readable. Plus, I don't like the extra level of indenting
that comes with having a 'with' statement.

"Scott McNair" <sc**********@sfmco.takethispartout.comwrote in message
news:Xn********************@207.46.248.16...
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person
is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the
Intellisense
(in the case of passing it to another method). I'm not looking to gripe
or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.

Regards,
Scott McNair

Aug 23 '06 #2
"Scott McNair" <sc**********@sfmco.takethispartout.comwrote in message
news:Xn********************@207.46.248.16...
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person
is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.
There is a book called "The .NET Languages: A Quick Translation Guide" by
Brian Bischof. It is very helpful for translating the VB.NET stuff into
C#.

http://www.amazon.com/gp/product/189...e=UTF8&s=books

-- Alan
Aug 23 '06 #3
Scott,
Actually I believe one of the best tutorials on moving from VB.NET to C# is
to use Reflector and decompile your VB.NET Stuff into C#. Not only great
practice, but it will instantly make you fully aware of the vagaries of
vb.net (especially if Option Strict and Option Explicit weren't set to "On"!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Scott McNair" wrote:
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method). I'm not looking to gripe or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.

Regards,
Scott McNair
Aug 23 '06 #4
Scott McNair wrote:
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.
I'm not sure you even need a tutorial. Since you're coming from VB.NET
you already know everything about the framework. You just need to pick
up on a new syntax and language features. The C# specification would
be a good starting point. One language feature you have in C# that you
didn't have in VB.NET is anonymous methods and closures. A good
tutorial on that might be beneficial.
Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method). I'm not looking to gripe or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.
I don't think it's really needed. If long variables become cumbersome
to type you can always alias them by declaring a shorter variable name
that references the same object. I always try to use the actual
variable name though. It may require more typing, but it's also more
readable.

Aug 23 '06 #5
Scott McNair wrote:
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.
Find a good VB.NET to C# converter and use that.

If in doubt write the VB.NET, translate and view the generated code.
Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method). I'm not looking to gripe or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.
Dont ask me.

I like the WITH (even though I have mostly used it in Pascal).

Arne
Aug 24 '06 #6
Very pragmatic choice you've made...

O'Reilly's "C# & VB.NET Conversion Pocket Reference" covers syntax, grammar
and usage.
I wouldn't rule out the QuickStarts either as you can toggle between C# and
VB.NET right in the page.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

"Scott McNair" <sc**********@sfmco.takethispartout.comwrote in message
news:Xn********************@207.46.248.16...
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person
is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the
Intellisense
(in the case of passing it to another method). I'm not looking to gripe
or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.

Regards,
Scott McNair

Aug 24 '06 #7
Find a converter you like.
One that knows that:
"is" is not equivalent to "Is"
"typeof" is not equivalent to "TypeOf"
"!" is not always the proper equivalent to "Not" (sometimes you need "~")
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
"Scott McNair" wrote:
Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person is
migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two (http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Also, why are C# developers so adamantly opposed to the WITH statement? I
just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters. I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method). I'm not looking to gripe or
to start a flame war, I'm just curious as to why C# developers as a whole
don't like the idea of even having it present as an option.

Regards,
Scott McNair
Aug 24 '06 #8
Scott McNair <sc**********@sfmco.takethispartout.comwrote:
Also, why are C# developers so adamantly opposed to the WITH statement?
Because it makes it less clear what's going on.
I just wrote my first C# web app, and I had about 20 lines of code that all
referred to properties of uwgOrphans.HeaderStyleDefault.Style. I wound up
just hand-keying it all, but in this case a WITH-like statement would have
saved about 700 characters.
So create a new variable which refers to
uwgOrphans.HeaderStyleDefault.Style, and then do all of your operations
using that variable.
I've read of alternatives, but they're either
not recommended (in the case of USING) or they don't carry the Intellisense
(in the case of passing it to another method).
There's nothing wrong with using a helper variable - although making it
as short as possible would go against readability. We'd have to see the
exact code to know quite what the best solution would be, of course.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 24 '06 #9
Brian Gideon <br*********@yahoo.comwrote:
I'm not sure you even need a tutorial. Since you're coming from VB.NET
you already know everything about the framework. You just need to pick
up on a new syntax and language features. The C# specification would
be a good starting point. One language feature you have in C# that you
didn't have in VB.NET is anonymous methods and closures. A good
tutorial on that might be beneficial.
I wish C# really had closures. Anonymous methods are close, but you
need an appropriate delegate to start with. That makes life a bit more
restrictive than in languages such as Groovy and Ruby, as well as
making features like currying unlikely.

Maybe some time we'll get full closures...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 24 '06 #10
Jon Skeet wrote:
I wish C# really had closures. Anonymous methods are close, but you
need an appropriate delegate to start with. That makes life a bit more
restrictive than in languages such as Groovy and Ruby, as well as
making features like currying unlikely.
In C# 3.0, from what I see, the overloaded generic Func<...types are
effectively a way of getting around the type-by-name problem with
existing delegate types, but they won't help with all the existing
delegate definitions - you'd have to use the Func<...etc. everywhere a
custom delegate is used now.

Perhaps it could be fudged with an automatic coercion based on
underlying compatibility.

The looseness of Ruby / Groovy etc. comes more from duck typing than it
does from their implementation of closures being different from C#'s.
Maybe some time we'll get full closures...
C# does have full closures. What it doesn't have is an easy way to
convert delegates, even where they're structurally compatible.

-- Barry

--
http://barrkel.blogspot.com/
Aug 24 '06 #11
Barry Kelly <ba***********@gmail.comwrote:
Jon Skeet wrote:
I wish C# really had closures. Anonymous methods are close, but you
need an appropriate delegate to start with. That makes life a bit more
restrictive than in languages such as Groovy and Ruby, as well as
making features like currying unlikely.

In C# 3.0, from what I see, the overloaded generic Func<...types are
effectively a way of getting around the type-by-name problem with
existing delegate types, but they won't help with all the existing
delegate definitions - you'd have to use the Func<...etc. everywhere a
custom delegate is used now.
I can't remember off-hand - are they just declared to return object? I
need to have another look at exactly what can be done easily with
anonymous methods...
Perhaps it could be fudged with an automatic coercion based on
underlying compatibility.

The looseness of Ruby / Groovy etc. comes more from duck typing than it
does from their implementation of closures being different from C#'s.
Well, there's no "general" closure-type - unless you count MethodInfo,
and even that doesn't allow for the kind of "runtime overload" that
Groovy's closures provide (which, I agree, is due to duck typing).
Maybe some time we'll get full closures...

C# does have full closures. What it doesn't have is an easy way to
convert delegates, even where they're structurally compatible.
I think it depends on exactly what we mean by "having closures", and
that's not a debate which is particularly useful :(

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 24 '06 #12
Jon Skeet wrote:
Barry Kelly <ba***********@gmail.comwrote:
In C# 3.0, from what I see, the overloaded generic Func<...types are
effectively a way of getting around the type-by-name problem with
existing delegate types, but they won't help with all the existing
delegate definitions - you'd have to use the Func<...etc. everywhere a
custom delegate is used now.

I can't remember off-hand - are they just declared to return object? I
need to have another look at exactly what can be done easily with
anonymous methods...
The return type and the parameter types are all generic parameters, so
given a Func<...generic overload with enough generic parameters (I
think they go up to 9 or 10 or so), it can match any method signature.
Thus, with implicit conversions, it would be possible to write
relatively general library routines that did things like currying etc.
(You'd still need a bunch of overloads, but you'd only have to do it
once...)
Perhaps it could be fudged with an automatic coercion based on
underlying compatibility.

The looseness of Ruby / Groovy etc. comes more from duck typing than it
does from their implementation of closures being different from C#'s.

Well, there's no "general" closure-type - unless you count MethodInfo,
and even that doesn't allow for the kind of "runtime overload" that
Groovy's closures provide (which, I agree, is due to duck typing).
Well, you could just about do that with 'params object[] args' if you
needed to, and is something I've done in the past.
C# does have full closures. What it doesn't have is an easy way to
convert delegates, even where they're structurally compatible.

I think it depends on exactly what we mean by "having closures", and
that's not a debate which is particularly useful :(
Well, I think closures are historically based around the closure of the
lexical scope - that variables in the outer scope are captured by the
closure and live on as long as the created closure does.

-- Barry

--
http://barrkel.blogspot.com/
Aug 25 '06 #13
I don't know if this is true in VB 2005, but in VB 6 using the with ... end
with block actually improved the speed of a program and was one of the
performance suggestions from Microsoft.

Mike Ober.

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:Ou7Hg.4111$_q4.492@dukeread09...
Scott McNair wrote:
>Is there a good tutorial for VB.NET programmers looking to migrate to C#?
I've found several tutorials that assume that the person is new to
programming in general, and I've found a few that assume that the person
is migrating from C++, but I have yet to find any that cater to the
experienced VB.NET developer.

I've found a quick reference that compare the language structures of the
two
(http://www.harding.edu/USER/fmccown/...omparison.html)
but ideally I'd like to find some tutorials as well.

Find a good VB.NET to C# converter and use that.

If in doubt write the VB.NET, translate and view the generated code.
>Also, why are C# developers so adamantly opposed to the WITH statement?
I just wrote my first C# web app, and I had about 20 lines of code that
all referred to properties of uwgOrphans.HeaderStyleDefault.Style. I
wound up just hand-keying it all, but in this case a WITH-like statement
would have saved about 700 characters. I've read of alternatives, but
they're either not recommended (in the case of USING) or they don't carry
the Intellisense (in the case of passing it to another method). I'm not
looking to gripe or to start a flame war, I'm just curious as to why C#
developers as a whole don't like the idea of even having it present as an
option.

Dont ask me.

I like the WITH (even though I have mostly used it in Pascal).

Arne

Aug 25 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Damian Brown | last post by:
www.phpexpert.org
175
by: Lucas Raab | last post by:
One thing I've always kind of wondered is what is the average age of a Python programmer?? What age groups use Python?? Something to think about....
108
by: Zooko O'Whielacronx | last post by:
I'm a fan of Greg Ewing's PyGUI . I used it to code a simple game for my son , and enjoyed it. Programming with wxPython feels like programming with a C++ tool that has been wrapped in Python....
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
176
by: basecamp | last post by:
just checking the average age of programmers using this group -- thanks
55
by: amanda992004 | last post by:
Excluding the factors of the brain capability, i.e I am not asking about this factor, if you are a single, aside from enjoying coding or debugging, how do you make time to eat properly, i.e...
7
by: guy | last post by:
Stirring up trouble here;) why is it that C# programmers try and denigrate VB.NET while VB.NET developers seem to have no problem with C# but just prefer VB.NET? I use both and this generally seems...
8
by: M_Mann | last post by:
Hello, Pls excuse if you consider this off-topic. Conceptual artists seek programmers here. We are authors of "Exhibition of Living Managers" (MANAGEX, www.managex.info) which is is global...
6
by: Biel | last post by:
Folks, One curiosity; - When can I affirm that one programmer C++ have the advanced level? - Is there some classical definition of parameters applied to C++ for define it?
1
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.