Assume I have an array ArrayVariable = New System.Int32(){1,1,2,2,3,4,4,5}
And I wish to sum the distinct values into Sum.
I know how to find distinct values, but I am not able to sum them
Any idea?
Thanks in Advance!
-Ashwin A.K
Assume I have an array ArrayVariable = New System.Int32(){1,1,2,2,3,4,4,5}
And I wish to sum the distinct values into Sum.
I know how to find distinct values, but I am not able to sum them
Any idea?
Thanks in Advance!
-Ashwin A.K
Check as below
Use ArrayVariable.Distinct().ToArray.Sum(Function (r) Double.Parse(r.ToString))
Mark as solution if this help you
Thanks
Brilliant!
The highlighted operation in
ArrayVariable.Distinct.ToArray.Sum(Function(s) s)
didn’t show up in intellisense, so I thought it wouldnt work.
Thank you once again!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.