Click here to Skip to main content
11,479,486 members (46,637 online)
Click here to Skip to main content

Tagged as

Few extension methods of IEnumerable in C#

, 20 Jul 2011 CPOL 2.5K 1
Rate this:
Please Sign up or sign in to vote.
public static IEnumerable MakeAllLower(this IEnumerable myList){ foreach (var item in myList) yield return item.ToLower();}Could be rewritten as:public static IEnumerable MakeAllLower(this IEnumerable myList){ return myList.Select(item...
public static IEnumerable<string> MakeAllLower(this IEnumerable<string> myList)
{
    foreach (var item in myList)
        yield return item.ToLower();
}

Could be rewritten as:

public static IEnumerable<string> MakeAllLower(this IEnumerable<string> myList)
{
    return myList.Select(item => item.ToLower());
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

SergeyT2
Software Developer
Russian Federation Russian Federation
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 20 Jul 2011
Article Copyright 2011 by SergeyT2
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid