Lambda Expressions in C#

To work with lambda expressions, we need to know at least some basic functionality on List and collections. Like Sql server we can Query the list from the front end and filter or remove or add some sort of data. Below are the some of the examples of the list operations.


Exists in Lambda Expression
bool result = feedDataList.Exists(x =>                           x.CC_ID.Equals(assortedData.resource.id, StringComparison.OrdinalIgnoreCase))


First in Lambda expression
var result = feedDataList.First(x => x. CC_ID.Equals(assortedData.resource.id, StringComparison.OrdinalIgnoreCase));


Where in lambda Expression
var result = feedDataList.Where(w => w.CC_ID == assortedData.resource.id).ToList().ForEach(i => i.EVENT_TYPE = eventType);


Remove All in Lambda Expression
feedDataList.RemoveAll(x => x.CC_ID == assortedData.resource.id);