VB.NET editor and generated code

Here are some suggested improvements.

  • In VB.NET, the editor doesn’t put the first letter of keywords in uppercase. Why not but then would be better to put the sample code in lowercase (thus implicitly adopting lowercase convention).
  • In VB.NET, when one writes “<” then “>” is automatically added which is not adapted to this language, we use “<” and “>” for comparisons, and there is not syntax where a word is wrapped in those symbols
  • The sample code not very idiomatic as it does declaring and assigning variables using 2 lines. Better do that I one go.
  • With Linq, it is possible to read an array of integers with shorter code.

So instead of:

    Sub Main ()
        
        Dim n as Integer
        n = Console.ReadLine() ' the number of temperatures to analyse

        Dim inputs as String()
        inputs = Console.ReadLine().Split(" ")
        For i as Integer = 0 To n-1
            Dim t as Integer ' a temperature expressed as an integer ranging from -273 to 5526
            t = inputs(i)
        Next

would be:

    Sub Main ()
        
        Dim n = CInt(Console.ReadLine) ' the number of temperatures to analyse
        Dim temps = (From s In Console.ReadLine.Split(" ", StringSplitOptions.RemoveEmptyEntries) 
            Select CInt(s)).ToList ' a temperature expressed as an integer ranging from -273 to 5526