Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Apr 12, 2016

Find Max length of string array


My requirement was to get the string with the longest value and the shortest value from a huge array. Naturally I was inclined to use the Max() and Min() extensions of Array. But it was throwing queer results. I was stumped, why was it not behaving uniformly? Then I realized for Max or Min on a string all it does is a alphabetical sorting and returning the top and the bottom of the sorted list. I also added a simple lambda solution to it.