.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

A simple LINQ query on Collection

Posted By:Sajid P K       Posted Date: October 12, 2010    Points: 15    Category:    URL: http://www.dotnetspark.com  

Following code demonstrate use of LINQ query. The query will returns strings from the array of strings which having its length greater than Five
 

The query will returns strings from the array of strings which having its length greater than Five

static void Main(string[] args)  
   {  
         string []myNames = "saji","sajid","sa","sajdipk"};             
         IEnumerable query = from name in myNames 
                             where name.Length < 5 
                             select name;       
     foreach(string n in query)       
     {             
       Console.WriteLine(n);         
     }          
  
   Console.ReadLine();   
     
   }

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend