Skip to content
Loading
  • Ashutosh Gupta
    +1
    delegates are nothing but function pointer in c#, it mainly used today for callback, filters, perdicate in linq etc.
     
    Linq with collection where, First, FirstOrDefault etc clause where you want to get collection of items based on some filter and that filter is represented as delegate.  
     
    e.g. you have list of items = new List { 10, 25, 36, 65 } and you want item which are greater than 30
    then you can items.where(s => s > 30); or you want sepcific item with 25, Items.First(s => s == 25) 
    +1