LINQ Rules!

I can’t seem to talk up .Net and the use of LINQ in every situation that requires the use of a database, XML, or a collection.  Simple, fast, and elegant!

  int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

    var numsPlusOne =
        from num in numbers
        select num + 1;

    Console.WriteLine("Numbers + 1:");
    foreach (var i in numsPlusOne) {
        Console.WriteLine(i);
    }
Advertisements

About kmandew

Computer Scientists Interested in Solving Problems
This entry was posted in .Net, C#, LINQ and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s