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. Other Discussions
  3. The Weird and The Wonderful
  4. GetAssemblyVersion, VB style

GetAssemblyVersion, VB style

Scheduled Pinned Locked Moved The Weird and The Wonderful
announcement
8 Posts 5 Posters 71 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.
  • S Offline
    S Offline
    Sasa Cetkovic
    wrote on last edited by
    #1

    Public Shared Function GetAssemblyVersion() As String
    Dim version() As String = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split("."c)
    Return version(0) & "." & version(1) & "." & version(2) & "." & version(3)
    End Function

    Dijkstra was right...

    S O E 3 Replies Last reply
    0
    • S Sasa Cetkovic

      Public Shared Function GetAssemblyVersion() As String
      Dim version() As String = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split("."c)
      Return version(0) & "." & version(1) & "." & version(2) & "." & version(3)
      End Function

      Dijkstra was right...

      S Offline
      S Offline
      Southmountain
      wrote on last edited by
      #2

      anything special? sorry I am not good at VB...

      diligent hands rule....

      S 1 Reply Last reply
      0
      • S Southmountain

        anything special? sorry I am not good at VB...

        diligent hands rule....

        S Offline
        S Offline
        Sasa Cetkovic
        wrote on last edited by
        #3

        It would be almost the same in C#. He could have already gotten everything at Assembly.GetExecutingAssembly().GetName().Version, but he continued to get a string and split it, as any VB6 programmer would prefer. And then, in the next line, he joined the strings with the same character on which he split them, meaning he already had the same result on ToString().

        S D 2 Replies Last reply
        0
        • S Sasa Cetkovic

          It would be almost the same in C#. He could have already gotten everything at Assembly.GetExecutingAssembly().GetName().Version, but he continued to get a string and split it, as any VB6 programmer would prefer. And then, in the next line, he joined the strings with the same character on which he split them, meaning he already had the same result on ToString().

          S Offline
          S Offline
          Southmountain
          wrote on last edited by
          #4

          thanks for explaining it to me:rose:

          diligent hands rule....

          1 Reply Last reply
          0
          • S Sasa Cetkovic

            It would be almost the same in C#. He could have already gotten everything at Assembly.GetExecutingAssembly().GetName().Version, but he continued to get a string and split it, as any VB6 programmer would prefer. And then, in the next line, he joined the strings with the same character on which he split them, meaning he already had the same result on ToString().

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            Saša Ćetković wrote:

            as any VB6 programmer would prefer

            Remind me why. I have not touched VB6 since 2008.

            "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

            S 1 Reply Last reply
            0
            • D dan sh

              Saša Ćetković wrote:

              as any VB6 programmer would prefer

              Remind me why. I have not touched VB6 since 2008.

              "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

              S Offline
              S Offline
              Sasa Cetkovic
              wrote on last edited by
              #6

              I noticed a pattern that they really like string manipulation - using magic strings, concatenating HTML as strings in ASP Classic, concatenating SQL...

              1 Reply Last reply
              0
              • S Sasa Cetkovic

                Public Shared Function GetAssemblyVersion() As String
                Dim version() As String = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split("."c)
                Return version(0) & "." & version(1) & "." & version(2) & "." & version(3)
                End Function

                Dijkstra was right...

                O Offline
                O Offline
                obermd
                wrote on last edited by
                #7

                This looks like VB6 to VB.Net automated code converter generated code. I tried these when VS 2005 came out and discovered it was faster, easier, and less error prone to simply copy/paste my VB6 code into the IDE and then fix it. I also ended up with faster code as a result.

                1 Reply Last reply
                0
                • S Sasa Cetkovic

                  Public Shared Function GetAssemblyVersion() As String
                  Dim version() As String = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split("."c)
                  Return version(0) & "." & version(1) & "." & version(2) & "." & version(3)
                  End Function

                  Dijkstra was right...

                  E Offline
                  E Offline
                  englebart
                  wrote on last edited by
                  #8

                  There is some code that builds a dynamic Class name to load a different class as needed. The are multiple other places where this code was copied, but there is only a single, fixed class that is needed. Replace 10-20 lines of unnecessary code with “new Fixed()”

                  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