This will allow you to calculate the average of numbers in the given array. It also has the way to calculate the average of charaters in the given string array.
Sub Main() Dim marks() As Integer = {22, 44, 12, 55} Dim avg = marks.Average() Console.WriteLine("The Average of the Numbers are : " & avg)
Dim names() As String = {"HEFIN", "DOTNETSPIDER", "VISUAL STUDIO"}
Dim avgwordleng = names.Average(Function(m) m.Length) Console.WriteLine("Average Length of words in the array are :" & avgwordleng) End Sub
Remember to Import System.Linq *Note : This only works in Framework 3.5 Regards Hefin Dsouza
Response if you want me to upload the sample code project.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|