LINQ

Yesterday while my roommate (Sunil P Thomas) and me were taking about technology and he showed me some piece of code. He is working on .NET. In fact he started in Java and later moved to .NET. He showed me a feature called LINQ (language integrated query) in C#. It was a really cool feature and I believe Java also should adopt this feature. This feature enables programmers to query on object collections just like how we query on databases. LINQ’s syntax is very similar to SQL syntax. For eg:

string[] names = { "Burke", "Connor", "Frank",
                       "Everett", "Albert", "George",
                       "Harris", "David" };

    IEnumerable query = from s in names
                               where s.Length == 5
                               orderby s
                               select s.ToUpper();

    foreach (string item in query)
      Console.WriteLine(item);

LINQ can also be applied on XML. What a really cool feature?

Share/Save/Bookmark

If you enjoyed this post, make sure you subscribe to my RSS feed!



Related Posts:
  • JoSQL (SQL for Java Objects)


  • One Response to “LINQ”  

    1. 1 JoSQL (SQL for Java Objects) | Some Java, J2EE and WebSphere stuffs

    Leave a Reply