CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference between c#.net and VB.net

    You mean:

    List <string> list = new List <string> ();
    list [5] = "I'm an indexed property";
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  2. #17
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Difference between c#.net and VB.net

    perhaps some day they will be as cool as indexed properties in C++/CLI which I miss in C#, they are replaced with get_Something and set_Something methods
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #18
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference between c#.net and VB.net

    some day they will be as cool as indexed properties in C++/CLI which I miss in C#
    What is the difference between C++ indexed properties and C# indexed properties?
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  4. #19
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Difference between c#.net and VB.net

    a C# class can have only one indexed property, the "this", whereas a C++/CLI class can have multiple indexed properties that can have any name
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  5. #20
    Join Date
    Mar 2009
    Posts
    51

    Re: Difference between c#.net and VB.net

    Quote Originally Posted by Mutant_Fruit View Post
    You mean:

    Code:
    List <string> list = new List <string> ();
    list [5] = "I'm an indexed property";
    No, that's an indexer.



    I mean:

    Code:
    ...
    
    private:
        array<String^>^ myNames;
    public:
        property String^ Name[int]
        {
            String^ get(int index)
            {
                return myNames[index];
            }
            void set(int index, String^ value)
            {
                myNames[index] = value;
            }
        }
    
    ...
    
    // Usage:
     String^ name = obj->Name[3];
    In C# that could have looked something like:

    Code:
    ...
    
    private String[] myNames;
    
    public String Name[int]
    {
          get 
          {
             return myNames[index];
          }
          set
          {
             myNames[index] = value;
          }
    }
    
    ...
    
    // Usage:
     String name = obj.Name[3];
    Last edited by Zaccheus@Work; May 21st, 2009 at 08:09 AM.

  6. #21
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Difference between c#.net and VB.net

    you have forgotten:

    Quote Originally Posted by Zaccheus@Work View Post
    Code:
       property String^ Name[int]
       {
          ...
       }
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  7. #22
    Join Date
    Mar 2009
    Posts
    51

    Re: Difference between c#.net and VB.net

    You are right, I've edited my post!

  8. #23
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference between c#.net and VB.net

    Ah, very nice. I didn't realise that was possible in C++/CLI. I thought you were just referring to the regular indexer by a different name
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  9. #24
    Join Date
    Apr 2013
    Posts
    2

    Angry Re: Difference between c#.net and VB.net

    Ok people that bash on vb.net has not even looked into vb since the vb6 days. Those people can stay in their c# world and continue to look real dumb. C# and vb.net are almost the same. You can do almost the same things in c# and vb.net. My advice is to learn them both. Tired of hearing the old heads bash vb.net.

  10. #25
    Join Date
    Apr 2013
    Posts
    2

    Re: Difference between c#.net and VB.net

    Also those who say vb.net code can be jumbled...did you ever look at a hugh program I c#? That is the lamest excuse ever.

  11. #26
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Difference between c#.net and VB.net

    Naturally in the C# area of a forum most people would say they prefer C#. If the thread was posted in the VB.Net section the answers would be a bit different.

    The fact is that both are very good languages and can do many many things. Which is better depends on who you are and what you are doing. If you are a former VB or VBA coder then VB.Net is much easier to code in than C# simply because of the fact the C# is case sensitive and requires the use of ; after every line of code both of which are things that may trip up a coder who is not used to this. C# on the other hand would be easier for someone who has coded more in C/C++, Java or other similar language.

    Personally I find C# code to be a bit longer and harder to follow but that is because I have only used C# and Java script on a few occasions and have been writing in different versions of VB for many years.
    Always use [code][/code] tags when posting code.

Page 2 of 2 FirstFirst 12

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

Featured