Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. VB/C# Tips/Tricks

VB/C# Tips/Tricks

Scheduled Pinned Locked Moved The Lounge
csharphtmlquestionannouncement
27 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Luc Pattyn

    very good. alternatively: muy buen. :thumbsup:

    Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

    A Offline
    A Offline
    Anthony Mushrow
    wrote on last edited by
    #7

    As 'muy buen' is the same sentence but in a different language you should post it with the original sentence, rather than as an alternative :rolleyes:

    My current favourite phrase: I've seen better!

    -SK Genius

    Source Indexing and Symbol Servers Vehicle Simulation Demo - Mostly Works

    L 1 Reply Last reply
    0
    • A Anthony Mushrow

      As 'muy buen' is the same sentence but in a different language you should post it with the original sentence, rather than as an alternative :rolleyes:

      My current favourite phrase: I've seen better!

      -SK Genius

      Source Indexing and Symbol Servers Vehicle Simulation Demo - Mostly Works

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #8

      I often include a kind of checksum in my communications; and you just confirmed I got the message across alright. Thanks. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      A 1 Reply Last reply
      0
      • L Luc Pattyn

        I often include a kind of checksum in my communications; and you just confirmed I got the message across alright. Thanks. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        A Offline
        A Offline
        Anthony Mushrow
        wrote on last edited by
        #9

        I suspected as much, but I couldn't resist,

        My current favourite phrase: I've seen better!

        -SK Genius

        Source Indexing and Symbol Servers Vehicle Simulation Demo - Mostly Works

        1 Reply Last reply
        0
        • L Luc Pattyn

          I expect an alternate to be creative, i.e. to offer another concept, another view on things, and not the same idea implemented in a different language. If you consider different languages alternates, then most every T&T could get alternates added to it, to do the same thing in different languages (C#, C++, VB, Java, PHP, Perl, etc.) and real alternates would be hard to find. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #10

          What if the tip/trick is mainly about syntax tricks to accomplish something in a clever way? And what would you do with a tip/trick that you wanted to show in different langauges? Would you include 5 languages in the same tip/trick, or would you include alternates? What about a tip/trick called "The Nuances of Templates/Generics in C#/VB.NET/C++"? For the record, I don't think it would become much of a problem for people to find "real" alternates if the same tip/trick is written in a different language. Especially since I doubt many people will take things beyond VB.NET and C# (e.g., C++, Java, and so on). Something else I'm considering is splitting the tip/trick up according to language, rather than including the code snippets inline. So, it would be one tip/trick, but it would be replicated within itself with a header for each language. Then I can provide a link between each language version. For example:

          C# Version (VB.NET Version)

          // This is the C# version...

          This will be the C# article text, very similar to the VB.NET article text.

          VB.NET Version (C# Version)

          ' This is the VB.NET version...

          This will be the VB.NET article text, very similar to the C# article text.

          [WikiLeaks Cablegate Cables]

          L 1 Reply Last reply
          0
          • L Luc Pattyn

            very good. alternatively: muy buen. :thumbsup:

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #11

            muy buen. alternativamente: very good.

            [WikiLeaks Cablegate Cables]

            L 1 Reply Last reply
            0
            • G Gregory Gadow

              You asked for my opinion, so here it goes and damn the univoters :~ If you want to write your bit in just C#, great, but please do not flag it as VB. Even if "the technique works in both languages", sample code in C# is not very helpful to someone who is not familiar with it: you may as well write your code in Fortran, COBOL or 6510 Assembly. If something is flagged for both C# and VB, it is reasonable to expect that the article will be useful to someone who uses only one of those languages. If that is not the case, then only one of those tags should be used.

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #12

              Though that isn't what I was asking, that is good advice.

              [WikiLeaks Cablegate Cables]

              1 Reply Last reply
              0
              • A AspDotNetDev

                What if the tip/trick is mainly about syntax tricks to accomplish something in a clever way? And what would you do with a tip/trick that you wanted to show in different langauges? Would you include 5 languages in the same tip/trick, or would you include alternates? What about a tip/trick called "The Nuances of Templates/Generics in C#/VB.NET/C++"? For the record, I don't think it would become much of a problem for people to find "real" alternates if the same tip/trick is written in a different language. Especially since I doubt many people will take things beyond VB.NET and C# (e.g., C++, Java, and so on). Something else I'm considering is splitting the tip/trick up according to language, rather than including the code snippets inline. So, it would be one tip/trick, but it would be replicated within itself with a header for each language. Then I can provide a link between each language version. For example:

                C# Version (VB.NET Version)

                // This is the C# version...

                This will be the C# article text, very similar to the VB.NET article text.

                VB.NET Version (C# Version)

                ' This is the VB.NET version...

                This will be the VB.NET article text, very similar to the C# article text.

                [WikiLeaks Cablegate Cables]

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #13

                that is a lot of questions. If you have a common idea and several implementations, then yes, I would prefer to explain the idea first then offer implementations; or, alternatively, when explaining without implementation is hard to do, explain it once in a given implementation, then append alternatives to the initial document (hence not as alternates). The latter will not really be appreciated by people not familiar with your primary language though. The alternative is to write more than one T&T, give them similar titles (which do mention the implementation language), and add a note making them link to each other. The disadvantage is they will get diverging alternates, comments, replies, etc. However, there is another, and IMO bigger issue. I expect tip/tricks to be simple and concise (no more than two screenfuls), so maybe what you really should do is write an article. More than two languages would require an article for sure. Nuances, I wouldn't put them in a T&T. And then, assuming an article with only two languages involved, I prefer to show the implementations side-by-side, that is what I do sometimes on my site (e.g. here[^]). BTW: I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach. I know, the audience might be limited. :)

                Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                A V 2 Replies Last reply
                0
                • A AspDotNetDev

                  muy buen. alternativamente: very good.

                  [WikiLeaks Cablegate Cables]

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #14

                  excel(l)ent(e) :-D

                  Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    that is a lot of questions. If you have a common idea and several implementations, then yes, I would prefer to explain the idea first then offer implementations; or, alternatively, when explaining without implementation is hard to do, explain it once in a given implementation, then append alternatives to the initial document (hence not as alternates). The latter will not really be appreciated by people not familiar with your primary language though. The alternative is to write more than one T&T, give them similar titles (which do mention the implementation language), and add a note making them link to each other. The disadvantage is they will get diverging alternates, comments, replies, etc. However, there is another, and IMO bigger issue. I expect tip/tricks to be simple and concise (no more than two screenfuls), so maybe what you really should do is write an article. More than two languages would require an article for sure. Nuances, I wouldn't put them in a T&T. And then, assuming an article with only two languages involved, I prefer to show the implementations side-by-side, that is what I do sometimes on my site (e.g. here[^]). BTW: I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach. I know, the audience might be limited. :)

                    Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                    A Offline
                    A Offline
                    AspDotNetDev
                    wrote on last edited by
                    #15

                    Luc Pattyn wrote:

                    I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach.

                    Do you mean this comment?:

                    AspDotNetDev wrote:

                    Especially since I doubt many people will take things beyond VB.NET and C# (e.g., C++, Java, and so on).

                    Just to be clear, I mean that I don't see people writing a bunch of alternates for languages other than C# and VB.NET when the primary tip/trick and alternate are VB.NET and C#. Supposing somebody did decide to write a Java version, it may very well differ wildly from the C#/VB.NET version, which is another reason I would confine that to an alternate rather than clutter up the main text to explain both implementations when a reader only wants to know about one language. FYI, I created a suggestion to recommend CP make a way to create alternate views for a tip/trick (e.g., different languages) in addition to the existing "alternates" that currently exist.

                    [WikiLeaks Cablegate Cables]

                    L H 2 Replies Last reply
                    0
                    • realJSOPR realJSOP

                      If it's just a matter of code translation, it goes into the original tip/trick. I think I have one or two like that.

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                      A Offline
                      A Offline
                      AspDotNetDev
                      wrote on last edited by
                      #16

                      Sometimes there are slight variations. For example, VB.NET has a "select case" statement that works slightly different than the C# "switch" statement, so the tip/trick that made use of that had to show differing techniques between each language. It probably seemed a bit long-winded to somebody only interested in one language, so I split it into a tip/trick and an alternate.

                      [WikiLeaks Cablegate Cables]

                      1 Reply Last reply
                      0
                      • A AspDotNetDev

                        Luc Pattyn wrote:

                        I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach.

                        Do you mean this comment?:

                        AspDotNetDev wrote:

                        Especially since I doubt many people will take things beyond VB.NET and C# (e.g., C++, Java, and so on).

                        Just to be clear, I mean that I don't see people writing a bunch of alternates for languages other than C# and VB.NET when the primary tip/trick and alternate are VB.NET and C#. Supposing somebody did decide to write a Java version, it may very well differ wildly from the C#/VB.NET version, which is another reason I would confine that to an alternate rather than clutter up the main text to explain both implementations when a reader only wants to know about one language. FYI, I created a suggestion to recommend CP make a way to create alternate views for a tip/trick (e.g., different languages) in addition to the existing "alternates" that currently exist.

                        [WikiLeaks Cablegate Cables]

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #17

                        AspDotNetDev wrote:

                        I don't see people writing a bunch of alternates for languages other than C# and VB.NET when the primary tip/trick and alternate are VB.NET and C#

                        Not if the TT is language oriented; however what if the TT is algorithmic, then any language could fit.

                        AspDotNetDev wrote:

                        FYI, I created a suggestion

                        I did notice, and managed not to react to it... :-D However, if CP staff decides to put in some effort to accomodate you, I'd much rather see them spend the effort to the articles subsystem than the TT subsystem. As I said, in my view TTs ought to be short and simple. :)

                        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                        1 Reply Last reply
                        0
                        • A AspDotNetDev

                          Luc Pattyn wrote:

                          I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach.

                          Do you mean this comment?:

                          AspDotNetDev wrote:

                          Especially since I doubt many people will take things beyond VB.NET and C# (e.g., C++, Java, and so on).

                          Just to be clear, I mean that I don't see people writing a bunch of alternates for languages other than C# and VB.NET when the primary tip/trick and alternate are VB.NET and C#. Supposing somebody did decide to write a Java version, it may very well differ wildly from the C#/VB.NET version, which is another reason I would confine that to an alternate rather than clutter up the main text to explain both implementations when a reader only wants to know about one language. FYI, I created a suggestion to recommend CP make a way to create alternate views for a tip/trick (e.g., different languages) in addition to the existing "alternates" that currently exist.

                          [WikiLeaks Cablegate Cables]

                          H Offline
                          H Offline
                          Henry Minute
                          wrote on last edited by
                          #18

                          I'm with Luc on this one. Put both versions in the Tip/Trick. Make it an article.

                          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                          L 1 Reply Last reply
                          0
                          • H Henry Minute

                            I'm with Luc on this one. Put both versions in the Tip/Trick. Make it an article.

                            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                            L Offline
                            L Offline
                            Luc Pattyn
                            wrote on last edited by
                            #19

                            Almost a repost. :laugh:

                            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                            1 Reply Last reply
                            0
                            • L Luc Pattyn

                              that is a lot of questions. If you have a common idea and several implementations, then yes, I would prefer to explain the idea first then offer implementations; or, alternatively, when explaining without implementation is hard to do, explain it once in a given implementation, then append alternatives to the initial document (hence not as alternates). The latter will not really be appreciated by people not familiar with your primary language though. The alternative is to write more than one T&T, give them similar titles (which do mention the implementation language), and add a note making them link to each other. The disadvantage is they will get diverging alternates, comments, replies, etc. However, there is another, and IMO bigger issue. I expect tip/tricks to be simple and concise (no more than two screenfuls), so maybe what you really should do is write an article. More than two languages would require an article for sure. Nuances, I wouldn't put them in a T&T. And then, assuming an article with only two languages involved, I prefer to show the implementations side-by-side, that is what I do sometimes on my site (e.g. here[^]). BTW: I don't fully agree with your language comment; I could very well imagine an algorithmic T&T implemented both in C# and Java, when the standard classes, not the language syntax, force you to take a slightly different approach. I know, the audience might be limited. :)

                              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                              V Offline
                              V Offline
                              Vic Rauch
                              wrote on last edited by
                              #20

                              I looked at your example article and really liked the way you showed both C# and VB, plus allowing the reader to collapse either the C# or VB code is a GREAT idea. I'm new to VB.net and have never used any language like C#, so reading something where all the code is only in C# I have found does not help me at all. Your approach works very well. Thank you for presenting it here.

                              L 1 Reply Last reply
                              0
                              • V Vic Rauch

                                I looked at your example article and really liked the way you showed both C# and VB, plus allowing the reader to collapse either the C# or VB code is a GREAT idea. I'm new to VB.net and have never used any language like C#, so reading something where all the code is only in C# I have found does not help me at all. Your approach works very well. Thank you for presenting it here.

                                L Offline
                                L Offline
                                Luc Pattyn
                                wrote on last edited by
                                #21

                                :rose:

                                Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                                Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                                1 Reply Last reply
                                0
                                • A AspDotNetDev

                                  Just curious how you all handle writing tips/tricks that apply to both C# and VB.NET. I typically just include the code for both inline, though I'm thinking of writing them in C# and including the VB.NET version as an alternate if they are heavy on code. What approach do you take?

                                  [WikiLeaks Cablegate Cables]

                                  D Offline
                                  D Offline
                                  Doug Ivison
                                  wrote on last edited by
                                  #22

                                  Speaking as a user/recipient, not a poster: here's another vote for posting both C# and VB.NET. (If you posted the Java, too, I'd read it out of curiosity... never done Java (don't drink coffee, either ;) and that would be an easy / interesting way to be introduced to some.) Thanks, -- Doug

                                  1 Reply Last reply
                                  0
                                  • G Gregory Gadow

                                    You asked for my opinion, so here it goes and damn the univoters :~ If you want to write your bit in just C#, great, but please do not flag it as VB. Even if "the technique works in both languages", sample code in C# is not very helpful to someone who is not familiar with it: you may as well write your code in Fortran, COBOL or 6510 Assembly. If something is flagged for both C# and VB, it is reasonable to expect that the article will be useful to someone who uses only one of those languages. If that is not the case, then only one of those tags should be used.

                                    J Offline
                                    J Offline
                                    jsc42
                                    wrote on last edited by
                                    #23

                                    Yes please ... More FORTRAN code!

                                    G 1 Reply Last reply
                                    0
                                    • J jsc42

                                      Yes please ... More FORTRAN code!

                                      G Offline
                                      G Offline
                                      Gregory Gadow
                                      wrote on last edited by
                                      #24

                                      Can we have an RPG forum? :laugh:

                                      1 Reply Last reply
                                      0
                                      • L Luc Pattyn

                                        I expect an alternate to be creative, i.e. to offer another concept, another view on things, and not the same idea implemented in a different language. If you consider different languages alternates, then most every T&T could get alternates added to it, to do the same thing in different languages (C#, C++, VB, Java, PHP, Perl, etc.) and real alternates would be hard to find. :)

                                        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                                        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                                        K Offline
                                        K Offline
                                        Keith Badeau
                                        wrote on last edited by
                                        #25

                                        I see that already or the "alternate" is a link to someone else' work. Are there guidelines or rules of thumb posted here?

                                        L 1 Reply Last reply
                                        0
                                        • K Keith Badeau

                                          I see that already or the "alternate" is a link to someone else' work. Are there guidelines or rules of thumb posted here?

                                          L Offline
                                          L Offline
                                          Luc Pattyn
                                          wrote on last edited by
                                          #26

                                          Most FAQs can be reached through the "Help!" menu. Code Project Tips & Tricks FAQ[^] may be of interest to you. :)

                                          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                                          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                                          K 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups