This Code will let you know how to use the new LINQ Features to total the values given in an array. This only works in Framework 3.5
Dim nums() As Integer = {32, 33, 55, 77, 434, 233, 55, 7, 8, 9} 'Direct Dim sum = nums.Sum()
'Old Method Dim total As Integer = 0
For Each n As Integer In nums total = total + n Next
Console.WriteLine("The Sum of the Nums are : " & sum) Console.WriteLine("The Sum is : " & total)
Regards Hefin Dsouza
Download Complete Application
AttachmentsDownload (21381-20115-AddingNumbers.rar)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|