GetAssemblyVersion, VB style
-
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 FunctionDijkstra was right...
-
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 FunctionDijkstra was right...
anything special? sorry I am not good at VB...
diligent hands rule....
-
anything special? sorry I am not good at VB...
diligent hands rule....
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().
-
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().
thanks for explaining it to me:rose:
diligent hands rule....
-
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().
-
I noticed a pattern that they really like string manipulation - using magic strings, concatenating HTML as strings in ASP Classic, concatenating SQL...
-
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 FunctionDijkstra was right...
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.
-
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 FunctionDijkstra was right...
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()”