string[] test = { "absc", "abc", "abcder", "abcdg" };
how to find the index value of array whose element length is minimum in c#
Here i should get 1 as a output
<pre>string[] test = { "absc", "abc", "abcder", "abcdg" };
for
If you are familiar with Linq, you could do this with one line of code.
string[] test = { "absc", "abc", "abcder", "abcdg" }; var smallest = Array.IndexOf(test, test.First(s => s.Length == test.Min(st => st.Length)));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)