Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 58
#ASP.NET 55
ASP.NET 50
#DOTNET 49
.NET 40
WCF 21
DOTNET 12
c# 8
windows azure 7
SILVERLIGHT 7

Archive · View All
April 2011 9
March 2011 9
February 2011 8
December 2010 7
November 2010 5
September 2010 5
August 2010 5
May 2011 4
October 2010 4
January 2011 2

Using Lambda expression in FindAll()

Nov 26 2010 9:08AM by Dhananjay Kumar   

I got a critical comment from @amazedsaint. You can read his blog http://amazedsaint.blogspot.com/

If you read my previous post http://dhananjaykumar.net/2010/10/01/findall-finding-multiple-items-in-c-list/ ,

I am using a method GreaterThanHunAs predicate to pass as parameter to FindAll()

Instead of that we can use

  1. Anonymous method
  2. Lambda expression

So, I am going to show you here how we could use Lambda expression

List<int>lstgrthund = lst.FindAll(a=>a>100? true:false);

So here we are just writing a lambda instead of calling a function.

Program.cs

using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;

namespace ConsoleApplication24
{
    classProgram
    {
        staticvoid Main(string[] args)
        {
            List<int>lst = newList<int>();
                           lst.Add(20);
                           lst.Add(300);
                           lst.Add(400);
                           lst.Add(9);
                           lst.Add(19);
                           lst.Add(789);
                           lst.Add(45);
            List<int>lstgrthund = lst.FindAll(a=>a>100? true:false);
            foreach (var r inlstgrthund)
            {
                Console.WriteLine(r);
            }
            Console.ReadKey(true);            
        }
    }
}

Output

clip_image004

Tags: #DOTNET, #ASP.NET, ASP.NET, BRH, .NET,


Dhananjay Kumar
49 · 4% · 1198
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]