How to round down each number in array using Linq with VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Public Class Program
	Public Shared Sub Main()
        Dim arr As Double() = {3.14, 2.6, 1.128, 7.99}
		
        Dim result = From n In arr 
						Select Math.Floor(n)

        For Each n As Double In result
            Console.Write(n & " ")
        Next
    End Sub
End Class




' run:
'
' 3 2 1 7
' 

 



answered Jan 3, 2023 by avibootz
...