Results 1 to 40 of 40

Thread: Learning C# from VB

  1. #1

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Learning C# from VB

    Since the announcement from Microsoft that they are not going to develop VB anymore, and the fact that the majority of the code samples and user support is C#, I was thinking I should start learning C# as well. Does anyone know of a guide to learn C# for people who already know VB? I.E. a transition guide instead of learning from scratch.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Learning C# from VB

    Quote Originally Posted by cory_jackson View Post
    Since the announcement from Microsoft that they are not going to develop VB anymore
    Um, what announcement was that?

  3. #3

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    The first I saw was this. Then I searched Google News and found several other articles to verify.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Learning C# from VB

    The vast majority of code is near enough the same, just with semi-colons at the end of lines;

    Most of the differences are "beginner" syntax things, like variable declarations (eg: int i = 0; ), using square brackets for arrays, For loop syntax, and curly-brackets {} to indicate blocks of code (instead of things like End If / Loop / Next / ...).

    I would recommend a quick skim-read of a beginners C# tutorial, followed by creating a simple test program. You will probably find it is all a fairly easy transition, apart from things like the ones I mentioned, and they will become natural after a while.

  5. #5

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    Thanks si_the_geek. I've heard similar assurances from others. It's nice to know that it's not that hard to transition. My plan is to get a beginners guide like I started VB with and go from there. I thought I'd ask just in case someone knew of a transition guide. Damn, i hate curly brackets. Oh well.

    I see you're a F1 fan. Sucks they cancelled Australian round. I follow MotoGP and it's going to be a lean season of racing. :-(

  6. #6

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    On the bright side I should be able to understand more of the examples I find online. Many times I've wanted to do something in VB and could only find C# examples. Many of my posts hre to this wonderful community could have been avoided if I wasn't ignorant about C#. I just hate taking time away from billable hours to learn new things.

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    Consider this post:

    http://www.vbforums.com/showthread.p...ed-for-NET-5-0

    Still, C# is a language worth knowing because it is in the C family of syntax, which also includes Java and JavaScript, along with all the C, C++, and C#, so knowing the syntax isn't a bad thing. As you note, lots of examples are written in C#, too, so that's another reason.

    Frankly, I would say that you know VB well enough that the way you should learn C# is to come up with some modest project that interests you, and just write it in C#. By the end of the project, you'll be familiar with the syntax, and that's all you really need.
    My usual boring signature: Nothing

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Learning C# from VB

    I'd agree with that.

    Quote Originally Posted by cory_jackson View Post
    I see you're a F1 fan. Sucks they cancelled Australian round. I follow MotoGP and it's going to be a lean season of racing. :-(
    I've only just heard, and on checking it seems that it is already a much bigger impact than one race, the next two have been postponed and: "it is expected the F1 season can begin at the end of May."

  9. #9

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    si_the_geek: Yeah, I like how they "postpone" a race but they don't give any dates. Sounds suspiciously like "cancelled". And Austin was shot anyway because as of today there's a travel ban to the US from Europe. So that wasn't going to happen anyway. OK, back to computer programming topics.

    Shaggy Hiker: I was also thinking that the next time I have a simple program I want for personal use, that I'll try it in C#. It's good advice. Thanks. And I can usually get what I need out of C# examples. Like you all have said, it's mostly syntax. But I'm guessing handy things like vbTab now need to be done differently. Maybe += to increment an integer doesn't exist in C#. I'm wondering what handy things C# has that VB doesn't. Time to learn! :-)

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    Quote Originally Posted by cory_jackson View Post
    I'm wondering what handy things C# has that VB doesn't. Time to learn! :-)
    I don't know of a single one....except unsafe pointers, but nobody uses those.

    For the most part, the two languages are the same. Up until 2005, you could find lists of what each language had that the other did not, but after 2005 MS decided to converge them. Later on, they decided to diverge them, again, but there were several years where the two were converged almost entirely.

    The result is that they are very similar, yet differences remain, and as far as I can tell, they are all to the advantage of VB. Things like semicolons and case sensitive names are both minor, but VB has them correct, while C# does not. If you spend even a second on a bug due to either an extra semicolon or a missing semicolon, then know that it is time wasted, because semicolons are vestigial and could be removed from the language entirely...except that tradition prevents it. The same is true of case sensitive variable names, though not everybody takes advantage of the value that case insensitive languages, like VB, offer.
    My usual boring signature: Nothing

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Learning C# from VB

    Quote Originally Posted by si_the_geek View Post
    I'd agree with that.

    I've only just heard, and on checking it seems that it is already a much bigger impact than one race, the next two have been postponed and: "it is expected the F1 season can begin at the end of May."
    They just announced yesterday that the Toyota Grand Prix of Long Beach is canceled as well as Formula Drift in April.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: Learning C# from VB

    Quote Originally Posted by Shaggy Hiker View Post
    I don't know of a single one....except unsafe pointers, but nobody uses those.

    For the most part, the two languages are the same. Up until 2005, you could find lists of what each language had that the other did not, but after 2005 MS decided to converge them. Later on, they decided to diverge them, again, but there were several years where the two were converged almost entirely.

    The result is that they are very similar, yet differences remain, and as far as I can tell, they are all to the advantage of VB. Things like semicolons and case sensitive names are both minor, but VB has them correct, while C# does not. If you spend even a second on a bug due to either an extra semicolon or a missing semicolon, then know that it is time wasted, because semicolons are vestigial and could be removed from the language entirely...except that tradition prevents it. The same is true of case sensitive variable names, though not everybody takes advantage of the value that case insensitive languages, like VB, offer.
    For the most part the compiler will puke at you about missing semi colons and syntax so rarely will you come into that scenario. I have been a VB guy for sooo long but it wasnt until I was forced to learn it back in 2010 or so that I found it easier and less verbose. Its the primary language of .net and as the announcement of VB being put out to pasture that its even more so needed to be learned.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    Thanks RobDog888. BTW I had a friend with a Ducati 851 and 888. I loved those bikes. I think of them whenever I see "888".

  14. #14
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    Quote Originally Posted by RobDog888 View Post
    For the most part the compiler will puke at you about missing semi colons and syntax so rarely will you come into that scenario.
    Yeah, it's certainly better with continuous compilation, but even the time taken to fix a compiler error about a missing semicolon is time wasted. The compiler knows what is missing and knows where. It doesn't care about the semicolon, it just complains when that useless appendage isn't in the right, useless, place. It was far worse in C compilers of old, where you wouldn't know about the missing semicolon until later on when it caused real trouble, but it's still useless.

    As for case sensitivity, it really doesn't matter whether the compiler catches it or not. The advantage of case insensitivity is when you have case-correcting, as VB does: Always put at least one capital into every name, then type everything in lower case. If it doesn't case correct...stop and figure out why. Usually, it's something simple like a typo that results in a compiler error anyways, but when it's not that...that's when it gets interesting.
    My usual boring signature: Nothing

  15. #15

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    If anyone else comes across this later I did find this helpful reference on Wikipedia.

  16. #16
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,392

    Re: Learning C# from VB

    Another link that may be of interest:

    https://www.zdnet.com/article/micros...n-it-to-net-5/

  17. #17
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Learning C# from VB

    C# can be learnt - just takes some time to read, study, test and start using it everyday. Once you get used with the syntax the mistakes and errors will be reduced. Bigger problem is switching between languages, syntax and features where first hour you will add semicolons, define variables with the type first and so on. Anyway it is not a big trouble.

    It is more interesting what happens after moving to C# because sticking to .NET Framework will become similar problem like sticking to VB - it will become supported only for security updates. The new .NET 5 will put .NET Framework in the past. Any new code will be .NET Core one and many libraries won't support .NET Framework by their authors because the difference between .NET Core/.NET 5 will become too big effort for such support.

    This is the link to Marc Gravell's blog (one of core developers in StackOverflow and creator of great libraries) where he explains about the problem with .NET 5/Core/Framework: .NET Core, .NET 5; the exodus of .NET Framework?

  18. #18
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    532

    Re: Learning C# from VB

    This is gonna be annoying trying to remember and re-Googling for something to equal another in C# I have to use == instead of a single =, not equals (a != b) for a <> b, (!(a == b)) for Not a = b, (object.ReferenceEquals(a, b)) for a is b, (!object.ReferenceEquals(a, b)) for a IsNot b, (!(a is b)) for TypeOf a IsNot b, (int i = 0; i < number; ++i) for i As Integer = 0 To number - 1

  19. #19

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    I did programming in the 80's for school then never as I was a CADD guy. Wrote some scripts hear and there. Some macros. Then I had an opportunity to do some programming work and decided to learn a real programming language again. I knew BASIC from school, VBScript, and VBA so I thought I should consider VB.NET first. Despite exposure to some VBish languages before, I found it much easier to read and better organized. I was sure not to be biased and tried to get into C# but I found it hard to read and the structure unintuitive. I think the block style of VB is superior to C# and the syntax is closer to human written language. And cine I knew it was using the same framework and distilled into the MSIL same as C# I went with it, mostly for the syntactic sugar. I never could figure out why people opted for C#. VB is much prettier and I can get more code into a given number of lines and scroll much less. Oh well. I do understand that it's better to only have one major language they have to develop and support. But like you I'm already missing all the little shortcuts like vbCrLf. Hopefully there will be some C# equivalents to make up for it.

  20. #20
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    532

    Re: Learning C# from VB

    Quote Originally Posted by cory_jackson View Post
    Hopefully there will be some C# equivalents to make up for it.
    There are some VB to C#, C# to VB converters online. So we can stick with VB until we get the hang of C#.

    My favorite is http://converter.telerik.com/
    Last edited by Peter Porter; Mar 13th, 2020 at 04:57 PM.

  21. #21
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Learning C# from VB

    VB is more readable than C#. It is like the comparison between Pascal and C in the past. Pascal was more readable and people start quicker to create programs.

    VB also has syntax sugar. Watching talks and presentations of Mads Torgersen and Jon Skeet, who work on C# syntax features, I've seen many features VB.NET had before C#. And many times I feel it is easier, shorter and more readable to write something in VB.NET instead in C#.

    Currently many new features of C# come from the overbloated JavaScript developers. And JS devs are doing ***** (self-censored)

    I am really happy with the syntax improvements of VB.NET. Currently I am supporting (but also adding new features) to VB.NET apps written using VS 2008, 2013, 2017 and 2019. People should read about that syntax sugar in the newer versions and start to use it. VB.NET became much more easier to program latest versions.

  22. #22

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    HA! The first language I learned in 1987 at college was Pascal. I can even remember the mainframe we used, a DEC VAX/VMS 8600
    ****, I'm old. (Also self censored) ;-)

  23. #23
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    The retirement of VB is not too big a deal. The true power of VB.Net comes from the Framework, not the language. While my "muscle memory" works seamlessly with the BASIC syntax, I don't foresee a problem retraining my instincts for a C based syntax. I've always found the C language to be quite beautiful and elegant. Of course you can write some truly atrocious and intelligible code with it, more so than any BASIC syntax.

    I knew the day would come when this would happen. BASIC just has too much of a stigma. For the vast majority of it's life it's always been considered a toy language. This was always inevitable.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  24. #24
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    Quote Originally Posted by peterst View Post
    VB is more readable than C#.
    I wouldn't go that far. While I program primarily in VB, when I look up code online, I look for C# code. Not only is C# code far easier to find, I find it much easier to understand on a glance. VB is quite verbose and wordy. It looks like clutter when a lot of the time when you're reading someone else's code.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  25. #25

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,104

    Re: Learning C# from VB

    I just mean "or" is more intuitive than a pipe colon. "AndAlso" better than "&&". I don't need to look up what the word "or" means, I did have to look it up in C#. Things like that. And indented blocks make sense without edification to me and I still haven't figured out the curly braces. And why is a whole line wasted to have one closing curly brace? It just looks silly to me. But truth of a matter like this is subjective. You saw beauty the first time you read C#, I see confusion.

  26. #26
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    I learned C/C++ before I ever used any VB, but I still find VB to be a cleaner language, so it really is subjective.
    My usual boring signature: Nothing

  27. #27
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    Quote Originally Posted by cory_jackson View Post
    I just mean "or" is more intuitive than a pipe colon. "AndAlso" better than "&&". I don't need to look up what the word "or" means, I did have to look it up in C#. Things like that. And indented blocks make sense without edification to me and I still haven't figured out the curly braces. And why is a whole line wasted to have one closing curly brace? It just looks silly to me. But truth of a matter like this is subjective. You saw beauty the first time you read C#, I see confusion.
    With respect to understanding what something does, by a wider ranged of people of varying skill level and knowledge, I agree 100%. BASIC syntax is infinitely clearer due to not having a bunch of weird symbols all over the code. But for me personally, I've long past the stage of needing to be coddled. At this point, I prize efficiency and "&&" is a lot more concise than "AndAlso". While I am primarily a BASIC programmer, I have dabbled in other languages including C++ and JavaScript, both of which share a common syntax. When you've written code in the C syntax for any considerable time, those confusing symbols become a lot less confusing and you begin to recognize the beauty in being concise.

    LAMBDA and anonymous function expressions is one of the things that slightly irritates me whenever I'm using VB and I see C# code online that does the same thing. Here's and example:-
    vbnet Code:
    1. Dim filteredList = myList.Where(Function(item) item Mod 2 = 0)

    The above code simply filters a list and returns all even numbers using LINQ with an anonymous function. Here's how it looks in C#:-
    c# Code:
    1. var filteredList = myList.Where(item => item % 2 == 0);

    Expressions like that can become quite complicated and long. I hate reading such expressions written in VB. It's just too wordy. The C# version is just so much more concise. It looks more like math than code which strangely enough, makes it a bit more readable.

    Now this is not to say that I find the C syntax perfect. I do think they can go a bit overboard sometimes on the symbols. Not so much in C# but you will see a lot of things written in C++ that just looks like someone's cat just ran over their keyboard. I also passionately hate the case sensitivity of C based languages and I find having to end every statement with a semi-colon extremely frustrating.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  28. #28
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    Quote Originally Posted by Niya View Post
    Here's and example:-
    vbnet Code:
    1. Dim filteredList = myList.Where(Function(item) item Mod 2 = 0)

    The above code simply filters a list and returns all even numbers using LINQ with an anonymous function. Here's how it looks in C#:-
    c# Code:
    1. var filteredList = myList.Where(item => item % 2 == 0);

    Expressions like that can become quite complicated and long. I hate reading such expressions written in VB. It's just too wordy. The C# version is just so much more concise.
    Let's see here. If we take out the word Function, then you have the word 'item' twice in each example. The VB has (), the C# has =>, which is harder to type, but is the same number of characters. Next, we have a 2 and a 0 in both of them, along with one = sign in both. The VB has the letters "Mod", while C# has a % and a second equals sign. However, you left out the semicolon that MUST be on the end of that line in C#, so that's three characters for "Mod" and three for %, =, and ;.

    In other words, your objection comes down to the word Function, because otherwise there are EXACTLY the same number of characters in each statement, and the characters in the C# are far harder for a good typist to hit than the ones in VB.
    My usual boring signature: Nothing

  29. #29
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    532

    Re: Learning C# from VB

    Quote Originally Posted by Niya View Post
    I hate reading such expressions written in VB. It's just too wordy. The C# version is just so much more concise. It looks more like math than code which strangely enough, makes it a bit more readable.

    Now this is not to say that I find the C syntax perfect. I do think they can go a bit overboard sometimes on the symbols. Not so much in C# but you will see a lot of things written in C++ that just looks like someone's cat just ran over their keyboard. I also passionately hate the case sensitivity of C based languages and I find having to end every statement with a semi-colon extremely frustrating.
    Coding stuff like (object.ReferenceEquals(a, b)) in C# would drive me nuts, specially since I know in VB it's simply written as a is b.

    On math, I would need a VB to C# converter to maintain my sanity.

  30. #30
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: Learning C# from VB

    Quote Originally Posted by Peter Porter View Post
    Coding stuff like (object.ReferenceEquals(a, b)) in C# would drive me nuts, specially since I know in VB it's simply written as a is b.

    On math, I would need a VB to C# converter to maintain my sanity.
    Actually, in C# you can just write "a == b" instead.

    Agree with you about math: there are subtle issues converting either way.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

  31. #31
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    Quote Originally Posted by Shaggy Hiker View Post
    In other words, your objection comes down to the word Function, because otherwise there are EXACTLY the same number of characters in each statement, and the characters in the C# are far harder for a good typist to hit than the ones in VB.
    Oh wait till you see some of the LINQ stuff in the wild. Imagine a LINQ statement several lines long. That looks really cluttered in VB compared to C#. Those "Function" keywords add up very quickly to create a cluttered mess. Though to be fair, with proper spacing and neat use of line-breaks, VB LINQ can look quite readable but C# just lends itself better to neatness due to its concise nature.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  32. #32
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: Learning C# from VB

    hello amigo
    i can tell you i learn vb 6 then vb net now c#
    the vb net is a ladder to c#
    tones of courses on web
    good luck

  33. #33
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: Learning C# from VB

    well, well, well....salsa still looks in on his ol' amigos here at VB6!

    Hope your programming skills have matured.

  34. #34
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: Learning C# from VB

    sami my dear friend
    long time
    Hope your programming skills have matured
    after 10 milions posts for sure

  35. #35
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Learning C# from VB

    Quote Originally Posted by Niya View Post
    Oh wait till you see some of the LINQ stuff in the wild. Imagine a LINQ statement several lines long. That looks really cluttered in VB compared to C#. Those "Function" keywords add up very quickly to create a cluttered mess. Though to be fair, with proper spacing and neat use of line-breaks, VB LINQ can look quite readable but C# just lends itself better to neatness due to its concise nature.
    That's when LINQ fails, as far as I'm concerned. Once it gets so complex it's not easy to read, then you've created write-only code. It's hard to maintain, and is likely to perform worse than not using it, so the only reason to do so is to be annoying. People seem to like to use LINQ the way the STL was used in C++: How complex a problem can I solve with this?
    My usual boring signature: Nothing

  36. #36
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Learning C# from VB

    Quote Originally Posted by Shaggy Hiker View Post
    That's when LINQ fails, as far as I'm concerned. Once it gets so complex it's not easy to read, then you've created write-only code. It's hard to maintain, and is likely to perform worse than not using it, so the only reason to do so is to be annoying. People seem to like to use LINQ the way the STL was used in C++: How complex a problem can I solve with this?
    Indeed. LINQ is about simplifying complex code. If it ends up recomplexifying it then that defeats the purpose. Readability of code should always be top priority unless performance is critical and LINQ rarely improves performance to the degree that you'd use it for that purpose.

  37. #37
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Learning C# from VB

    Quote Originally Posted by cory_jackson View Post
    I see you're a F1 fan. Sucks they cancelled Australian round. I follow MotoGP and it's going to be a lean season of racing. :-(
    I'm in withdraws already... no F1, no Formula E, no NHRA, no Indy.... Heck... at this point, I think I'd even go for some NASCAR... but no go there either.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  38. #38
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    Quote Originally Posted by Shaggy Hiker View Post
    That's when LINQ fails, as far as I'm concerned. Once it gets so complex it's not easy to read, then you've created write-only code. It's hard to maintain, and is likely to perform worse than not using it, so the only reason to do so is to be annoying. People seem to like to use LINQ the way the STL was used in C++: How complex a problem can I solve with this?
    I don't disagree. What I'm basically saying is if you compare the most readable code possible in VB, the C# version of that same code is more readable. However, this is all my opinion. Don't take anything I say as gospel truth. I hate writing C code but love reading it. I love writing VB code but hate reading it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  39. #39
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Learning C# from VB

    Honestly, the way I learned C# was to blag myself a job by saying I knew it and then learn by doing. I was fully up to speed within a day or two and you're not going to struggle any more than I did. Maybe write Hello World and FizzBuzz before the interview but you're not going to need any more practice than I did.

    As for which is better/more readable, I find the argument somewhat fatuous. They're both perfectly good and perfectly readable. You might as well debate whether Times New Roman is more readable than MS Sans Serif (it does have slightly curlier brackets, after all).
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  40. #40
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Learning C# from VB

    Quote Originally Posted by FunkyDexter View Post
    You might as well debate whether Times New Roman is more readable than MS Sans Serif (it does have slightly curlier brackets, after all).
    Why would we debate that? Everyone knows Times New Roman is more readable. There's no debate
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width