How to get the length of strings in array elements LINQ

Mansour_Dalir 2,036 Reputation points
2024-05-02T17:45:38.65+00:00

Dim MyArray as String()={"AB","ABC","DFG"}

Need Result

Dim int1 as Integer=8

Developer technologies VB
{count} votes

Accepted answer
  1. Dewayne Basnett 1,381 Reputation points
    2024-05-02T20:17:58.3533333+00:00

    How about this

        Dim MyArray As String() = {"AB", "ABC", "DFG"}
    
        Dim totLen As Integer = (From el In MyArray Select el.Length).Sum
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.