locked
Shifting from VB.NET to C#? RRS feed

  • Question

  • Hey guys,

    It seems to me that C# has more features compared to VB.NET. I have started with VB.NET, but I am thinking of shifting to C# now.

    Do you agree or disagree and why?


    ClintonYeboah

    Monday, September 28, 2015 4:31 PM

Answers

  • What new features?

    If you are thinking of a change I would suggest WPF vs WinForms.  Now there is a change.  

    If you are trying to get a job in Dot.Net development then I would suggest learning C# since it is the most used Dot.Net language.  As well learn WPF with MVVM.


    Lloyd Sheen

    • Marked as answer by Clinton Yeboah Monday, September 28, 2015 4:42 PM
    Monday, September 28, 2015 4:34 PM
  • Which language you select is subjective to the job opportunities in your area. Both are capable of producing quality solutions and would be wise to know both languages in that knowing both increases your chances for finding a developer position. 



    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.
    Microsoft Developer tools
    Developer’s Guide to Windows 10 video series

    • Marked as answer by Clinton Yeboah Monday, September 28, 2015 7:27 PM
    Monday, September 28, 2015 7:10 PM
  • I guess there is only syntax difference then.


    ClintonYeboah

    Actually, there is another significant difference between VB and C#. VB is a Microsoft proprietary language, but C# is a "standard" language managed by the ISO (International Standards Organization).

    Now that Microsoft is actively engaged in supporting development for platforms other than Windows, I would consider learning C# in addition to VB

    • Marked as answer by Clinton Yeboah Tuesday, September 29, 2015 10:40 AM
    Tuesday, September 29, 2015 12:26 AM

  • That was me, but abusive in the Microsoft forums has become simple a button to call a moderator. 

    It does not mean that your message is real abusive. 

    However, in my perception it is asking likewise in a Ford Raptor is better in a Chevy garage. 



    My friend, I didn't ask about which one was better. Even beginners in programming will testify that no language is better than the other. Each is best in a particular field.

    One who has learned both VB and C# can say, "if I have an option to choose VB or C#, I would choose this or that". Because this or that. This was the kind of advice I was looking for.

    I have interest in programming, I just don't know which ones are worth my time.

    Am sure this will not offend you.


    ClintonYeboah

    I still wonder how you came up with this "It seems to me that C# has more features compared to VB.NET." without providing any background on why that would be so.

    AFAIK anything which can be performed in C# can be performed in VB and vice versa though perhaps not implemented in the exact same fashion. There's methods in C# and VB which neither can perform the exact method of the other.

    I don't see why a question of why or why not you should or should not switch would even be asked. It's not up to anybody else to figure out what you want to do. You don't mention any reason to want to switch other than something seems to you to be a certain way which the way is not true.

    What is true is there's more jobs for C# programmers. There's more code available on the net in C# for different things. More people program in C# than VB.Net. If the issue is not job related but rather being able to copy/paste available code then C# would be the way to go. If the issue is job related then go to Java or Python or Ruby or C++ because there's way more jobs available for those, according to various sites I've looked at, than C#.


    La vida loca


    Tuesday, September 29, 2015 11:10 AM

All replies

  • What new features?

    If you are thinking of a change I would suggest WPF vs WinForms.  Now there is a change.  

    If you are trying to get a job in Dot.Net development then I would suggest learning C# since it is the most used Dot.Net language.  As well learn WPF with MVVM.


    Lloyd Sheen

    • Marked as answer by Clinton Yeboah Monday, September 28, 2015 4:42 PM
    Monday, September 28, 2015 4:34 PM
  • I am just a student, a beginner. I found VB.NET quiet easy to begin with. Was wondering, if I should have started with C# rather.

    ClintonYeboah

    Monday, September 28, 2015 4:37 PM
  • Am also taking a look at the WPF and MVVM. Thanks...

    ClintonYeboah

    Monday, September 28, 2015 4:42 PM
  • You did mark the answer you liked directly. If you have a question about C# then Visit the C# forum. 

    Here it only marks you as a troll.

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral

    Be aware possibilities VB = C# possibilities 

    It is just as asking if you want to shift from English to Spanish because that is the first official language of more countries. 


    Success
    Cor



    Monday, September 28, 2015 5:38 PM
  • Hi Cor,

    Troll doesn't look good. But whatever, thanks for your contribution.

    I guess there is only syntax difference then.


    ClintonYeboah

    Monday, September 28, 2015 5:53 PM
  • Hey guys,

    It seems to me that C# has more features compared to VB.NET. I have started with VB.NET, but I am thinking of shifting to C# now.

    Do you agree or disagree and why?


    ClintonYeboah

    I find it amusing that people ask this question and I'm not certain how you came to this conclusion "It seems to me that C# has more features compared to VB.NET".

    With all of the information available on the internet I would determine for myself why or why not to shift or learn any other language. Not have other people try to provide either biased or non-biased input on why or why not I should do whatever I am thinking of doing. That makes no sense since I would have no idea whether the input from others is biased or not.

    I wouldn't let others tell me why I should buy a Ford Raptor over a Chevy whatever. That seems fairly idiotic IMO.

    If you've no idea why you think that C# would be better for whatever the particular programming interests you have are then nobody else can answer it for you. If you've not the ability to perform the research necessary to supply you with valid information for making your own decision then a bunch of opinions I suppose would have to suffice which is sad.

    Actually C++ is the most used .Net Language and much greater use than C#. And Java is a highly used language, much greater use than C#, and there's a company that provides a capability for Visual Studio to support Java development Integra Studio - develop true Java software under Microsoft Visual Studio.

    I suspect that you should figure out why you want to switch to using another language. And then figure out what language to switch to. Since C# and VB are so closely related my personal choice would be to learn C++ as there's plenty of converters online for converting C# to VB. Even though some implementations in C# they may not convert which would be a minimal amount and the good online C# to VB converters desire input about non-correctly converted code so they can modify their converters to convert the code correctly in the future. On the other hand a competent C++ programmer, with experience, can pretty much write anything at any level for using with a Microsoft OS or any phone OS's.


    La vida loca

    • Edited by Mr. Monkeyboy Tuesday, September 29, 2015 7:55 AM
    • Proposed as answer by ryguy72 Wednesday, October 14, 2015 7:46 PM
    Monday, September 28, 2015 6:18 PM
  • I think it is quite funny that a person can ask a question which is then taken over by the forum.  A simple question leads to all this venom.  

    I saw nothing in his question that indicated a VB vs C# war, in fact when called a troll he was quite polite in his reply to that.

    You guys need to settle down.


    Lloyd Sheen

    Monday, September 28, 2015 6:39 PM
  • I think it is quite funny that a person can ask a question which is then taken over by the forum.  A simple question leads to all this venom.  

    I saw nothing in his question that indicated a VB vs C# war, in fact when called a troll he was quite polite in his reply to that.

    You guys need to settle down.


    Lloyd Sheen

    Who is "you guys"? And who are you to advise anybody else what they are required to do?

    La vida loca

    Monday, September 28, 2015 6:51 PM
  • I think it is quite funny that a person can ask a question which is then taken over by the forum.  A simple question leads to all this venom.  

    I saw nothing in his question that indicated a VB vs C# war, in fact when called a troll he was quite polite in his reply to that.

    You guys need to settle down.


    Lloyd Sheen

    Who is "you guys"? And who are you to advise anybody else what they are required to do?

    La vida loca

    I'm beginning to think I should delete this thread. I guess I made a mistake.

    Was looking for an advice, not a fight.

    ........................

    Wait is there even an option to delete a thread? :)


    ClintonYeboah

    Monday, September 28, 2015 6:55 PM
  • Oh mine, someone reported my question as abusive! Oh mine!!!

    Didn't see that coming! lol...


    ClintonYeboah

    Monday, September 28, 2015 6:57 PM
  • Which language you select is subjective to the job opportunities in your area. Both are capable of producing quality solutions and would be wise to know both languages in that knowing both increases your chances for finding a developer position. 



    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.
    Microsoft Developer tools
    Developer’s Guide to Windows 10 video series

    • Marked as answer by Clinton Yeboah Monday, September 28, 2015 7:27 PM
    Monday, September 28, 2015 7:10 PM
  • I could ask the same of you

    Lloyd Sheen

    Monday, September 28, 2015 7:41 PM
  • Oh mine, someone reported my question as abusive! Oh mine!!!

    Didn't see that coming! lol...


    ClintonYeboah

    That was me, but abusive in the Microsoft forums has become simple a button to call a moderator. 

    It does not mean that your message is real abusive. 

    However, in my perception it is asking likewise in a Ford Raptor is better in a Chevy garage. 

    Ask that kind of questions in a Ford garage, they agree with you.

    Your question is simply meaningless, moreover, sometimes persons from a non real brand garage visits a forum and gives than an answer about the shiny mirrors on another brand. 


    Success
    Cor

    Monday, September 28, 2015 7:43 PM
  • I could ask the same of you

    Lloyd Sheen

    Yes. Then again you can't answer the question asked either. Or provide what venom means to you which probably would mean "not politically correct" if venom to you is supposedly in the post I provided which I would have to guess is according to you since you mention "you guys".

    Although I don't really care what you believe it's obvious something caused you to have a need to tell others your opinion which you provide no basis for regarding my post. If the post that I wrote causes issue with you then that's fine with me.


    La vida loca

    Monday, September 28, 2015 8:03 PM
  • I guess there is only syntax difference then.


    ClintonYeboah

    Actually, there is another significant difference between VB and C#. VB is a Microsoft proprietary language, but C# is a "standard" language managed by the ISO (International Standards Organization).

    Now that Microsoft is actively engaged in supporting development for platforms other than Windows, I would consider learning C# in addition to VB

    • Marked as answer by Clinton Yeboah Tuesday, September 29, 2015 10:40 AM
    Tuesday, September 29, 2015 12:26 AM
  • I am just a student, a beginner. I found VB.NET quiet easy to begin with. Was wondering, if I should have started with C# rather.

    IMHO starting with VB is a good choice.  Some will say that it creates bad habits, and it is true that VB tends to enforce good practice less than other languages.  But if you are paying attention to what you are doing, and critically evaluate your VB code as you go, then you will end up applying the same good coding habits that C# and similar languages enforce.  Then the transition to those other languages is relatively easy.

    Also note that in .Net a very large proportion of your code is actually the framework, not the language, and that's common across the VS range. 

    Tuesday, September 29, 2015 1:12 AM
  • Some will say that it creates bad habits, and it is true that VB tends to enforce good practice less than other languages. 

    I couldn't disagree with that statement more.

    If you set Option Strict On, Option Explicit On, and Option Infer Off, you have to code in a very rigid (but correct) way.

    Do you disagree?


    "I never failed once... It just happened to be a 2000-step process." -- Thomas Edison

    Tuesday, September 29, 2015 1:19 AM
  • If you set Option Strict On, Option Explicit On, and Option Infer Off, you have to code in a very rigid (but correct) way.

    Do you disagree?

    Of course it depends on what you regard as good practice, but two examples that spring to mind are:

    - Function return value - Return statement is optional, and argument to the Return statement is optional.  The behaviour if Return is not used or is used without a value is not obvious.  Good practice would be a single explicit syntax for setting the return value.

    - Default instances. Not strictly an issue of the language perhaps, and more a result of the massive amount of legacy code, but still an issue for beginners with VB. Good practice would be disallowing the usage.

    The options control a lot of the issues related to misuse of variables and literals, but VB allows you to turn them off - they aren't enforced. Good practice would be making them non-optional, or at least defaulting to more sensible values.

    But my point was that some of this flexibility makes learning the language easier, and does not significantly impact the use of VB as a stepping stone onto other languages, provided it is approached with the right attitude, such as setting your options appropriately.

    Tuesday, September 29, 2015 2:28 AM
  • But my point was that some of this flexibility makes learning the language easier, and does not significantly impact the use of VB as a stepping stone onto other languages, provided it is approached with the right attitude, such as setting your options appropriately.

    You're right in that regard - the ability, and worse yet the default - is to be very relaxed in how things can be done and that can lead to a lot of misunderstanding later on.

    I bet fully a fourth of the questions here are because of just exactly that - the default settings allowing things that shouldn't be ever allowed.


    "I never failed once... It just happened to be a 2000-step process." -- Thomas Edison

    Tuesday, September 29, 2015 2:37 AM
  • Frank (and Acamar),

    VB is just a program language. I don't know how many natural languages you can speak, read and write. (Speaking fluently tells nothing about what I write bellow). But VB and C# follow simply rules of languages.

    In the way you handle it, you tell English is a poor language and Latin is superior. 

    English is likewise my native natural language not very Explicit, for sure not Strict and there is a lot of inferring when people use it. Despite or maybe because of that it is a very good language to communicate and (because of its adaption of words from many other language) mostly at least for native Indo-European languages speaking persons relative easy to understand.

    That is the same with VB while C# follows more strict the rules of C.

    https://en.wikipedia.org/wiki/Indo-European_languages  

    Does that mean people must first learn Shakespeare before they are learning English?



    Success
    Cor







    • Edited by Cor Ligthert Tuesday, September 29, 2015 7:41 AM
    Tuesday, September 29, 2015 7:36 AM
  • Does that mean people must first learn Shakespeare before they are learning English?

    No-one used words like 'poor' or 'superior' in regard to the languages, and there is nothing in those comments that could be construed as suggesting that someone learning programming 'must' proceed along any particular path.

    Tuesday, September 29, 2015 10:39 AM

  • That was me, but abusive in the Microsoft forums has become simple a button to call a moderator. 

    It does not mean that your message is real abusive. 

    However, in my perception it is asking likewise in a Ford Raptor is better in a Chevy garage. 



    My friend, I didn't ask about which one was better. Even beginners in programming will testify that no language is better than the other. Each is best in a particular field.

    One who has learned both VB and C# can say, "if I have an option to choose VB or C#, I would choose this or that". Because this or that. This was the kind of advice I was looking for.

    I have interest in programming, I just don't know which ones are worth my time.

    Am sure this will not offend you.


    ClintonYeboah

    Tuesday, September 29, 2015 10:53 AM

  • That was me, but abusive in the Microsoft forums has become simple a button to call a moderator. 

    It does not mean that your message is real abusive. 

    However, in my perception it is asking likewise in a Ford Raptor is better in a Chevy garage. 



    My friend, I didn't ask about which one was better. Even beginners in programming will testify that no language is better than the other. Each is best in a particular field.

    One who has learned both VB and C# can say, "if I have an option to choose VB or C#, I would choose this or that". Because this or that. This was the kind of advice I was looking for.

    I have interest in programming, I just don't know which ones are worth my time.

    Am sure this will not offend you.


    ClintonYeboah

    I still wonder how you came up with this "It seems to me that C# has more features compared to VB.NET." without providing any background on why that would be so.

    AFAIK anything which can be performed in C# can be performed in VB and vice versa though perhaps not implemented in the exact same fashion. There's methods in C# and VB which neither can perform the exact method of the other.

    I don't see why a question of why or why not you should or should not switch would even be asked. It's not up to anybody else to figure out what you want to do. You don't mention any reason to want to switch other than something seems to you to be a certain way which the way is not true.

    What is true is there's more jobs for C# programmers. There's more code available on the net in C# for different things. More people program in C# than VB.Net. If the issue is not job related but rather being able to copy/paste available code then C# would be the way to go. If the issue is job related then go to Java or Python or Ruby or C++ because there's way more jobs available for those, according to various sites I've looked at, than C#.


    La vida loca


    Tuesday, September 29, 2015 11:10 AM
  • Does that mean people must first learn Shakespeare before they are learning English?

    No-one used words like 'poor' or 'superior' in regard to the languages, and there is nothing in those comments that could be construed as suggesting that someone learning programming 'must' proceed along any particular path.

    Thank you for calling me "No-one" almost the same like Nobody but you did probably beside Shakespeare also not read Homerus (in this case Odyssey).

    If you start talking about good practise and Frank about programming with Option Infer Off then you are talking about the lack of theoretical inbuild trapping for failuires. (Which was needed in the case programming was done with a TeleType terminal to prevent errors) (Basic, Unix and C).

    Your sentence shows for me, that you in fact have no knowledge about any classical natural written language beside English.

    By the way, I did agree with your original reply.


    Success
    Cor

    Tuesday, September 29, 2015 11:42 AM
  • In regards to Option Infer Off, I believe with Option Strict On it's not bad. Consider the following C# using var similar to having Option Infer On and that var is used a lot with myself and other C# developers.

    using System;
    using System.IO;
    using System.Text;
    using System.Xml.Serialization;
    
    namespace ConsoleApplication1
    {
        [XmlRoot("myObject")]
        public class MyObject
        {
            [XmlElement("myProp", Namespace = "http://www.demo.us")]
            public string MyProp { get; set; }
    
            [XmlAttribute("myOther", Namespace = "http://www.demo.us")]
            public string MyOther { get; set; }
        }
    
        internal class Program
        {
            private static void Main(string[] args)
            {
                var xnames = new XmlSerializerNamespaces();
                xnames.Add("karen", "http://www.demo.us");
                var xser = new XmlSerializer(typeof(MyObject));
                using (var ms = new MemoryStream())
                {
                    var myObj = new MyObject()
                    {
                        MyProp = "Hello",
                        MyOther = "World"
                    };
                    xser.Serialize(ms, myObj, xnames);
                    var result = Encoding.ASCII.GetString(ms.ToArray());
                    /*
                        <?xml version="1.0"?>
                        <myObject xmlns:w="http://www.demo.us" w:myOther="World">
                          <w:myProp>Hello</w:myProp>
                        </myObject>
                     */
    
                    Console.WriteLine(result);
                }
                Console.ReadLine();
            }
        }
    }

    The above compiles just fine, no different than the following.

    using System;
    using System.IO;
    using System.Text;
    using System.Xml.Serialization;
    
    namespace ConsoleApplication1
    {
        [XmlRoot("myObject")]
        public class MyObject
        {
            [XmlElement("myProp", Namespace = "http://www.demo.us")]
            public string MyProp { get; set; }
    
            [XmlAttribute("myOther", Namespace = "http://www.demo.us")]
            public string MyOther { get; set; }
        }
    
        internal class Program
        {
            private static void Main(string[] args)
            {
                XmlSerializerNamespaces xnames = new XmlSerializerNamespaces();
                xnames.Add("karen", "http://www.demo.us");
                XmlSerializer xser = new XmlSerializer(typeof(MyObject));
                using (MemoryStream ms = new MemoryStream())
                {
                    var myObj = new MyObject()
                    {
                        MyProp = "Hello",
                        MyOther = "World"
                    };
                    xser.Serialize(ms, myObj, xnames);
                    string result = Encoding.ASCII.GetString(ms.ToArray());
                    /*
                        <?xml version="1.0"?>
                        <myObject xmlns:w="http://www.demo.us" w:myOther="World">
                          <w:myProp>Hello</w:myProp>
                        </myObject>
                     */
    
                    Console.WriteLine(result);
                }
                Console.ReadLine();
            }
        }
    }

    So in VB.NET we can do the same while in the majority of the declarations we are specifying the type to the right of the equals sign and two are not specified and are infered just as done in C#.

    Option Strict On
    Option Infer On
    Imports System.Xml.Serialization
    Imports System.IO
    
    <XmlRoot("myObject")> _
    Public Class MyObject
        <XmlElement("myProp", [Namespace]:="http://www.demo.us")> _
        Public Property MyProp() As String
        <XmlAttribute("myOther", [Namespace]:="http://www.demo.us")> _
        Public Property MyOther() As String
    End Class
    Module Module1
        Public Sub Main(ByVal args() As String)
            Dim xnames As New XmlSerializerNamespaces()
            xnames.Add("karen", "http://www.demo.us")
            Dim xser As New XmlSerializer(GetType(MyObject))
            Using ms As New MemoryStream()
                Dim myObj = New MyObject() With {.MyProp = "Hello", .MyOther = "World"}
                xser.Serialize(ms, myObj, xnames)
                Dim result = System.Text.Encoding.ASCII.GetString(ms.ToArray())
                '                
                '                    <?xml version="1.0"?>
                '                    <myObject xmlns:w="http://www.demo.us" w:myOther="World">
                '                      <w:myProp>Hello</w:myProp>
                '                    </myObject>
                '                 
                Console.WriteLine(result)
            End Using
            Console.ReadLine()
        End Sub
    End Module
    


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.
    Microsoft Developer tools
    Developer’s Guide to Windows 10 video series

    Tuesday, September 29, 2015 1:29 PM
  • Am also taking a look at the WPF and MVVM. Thanks...

    ClintonYeboah

    You can also look at Windows forms and MVPVM too.

    https://billkrat.wordpress.com/2010/12/24/model-view-presenter-view-model-mvpvm/

    Tuesday, September 29, 2015 4:23 PM