Filter to values in collection in one query

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-03-16T17:11:33Z Indexed on 2010/03/16 17:21 UTC
Read the original article Hit count: 159

Filed under:
|

Hi,

I have the following LINQ query:

            List<string> Types = (List<string>) Directory.GetFiles(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727")
                                                                                        Where(x => System.IO.Path.GetFileNameWithoutExtension(x).Contains("Microsoft"))   
                                                                                            .ToList<string>();

How could I modify this so it can only get the values stored in a collection, without writing another LINQ query (which I assume will impact performance?)?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ