Knowledge Management Banner

Knowledge Management Banner

C# : Lambda Expression, Async, Await : Part 32

Lambda Expression

  • It is ananonymous function that you can use to create delegate without specifying its type, They are helpfull in writing linq query.
Async & Await
  • These are the the two different functionality which are available in .net version 4.5 and above.
  • You can create any event to be async and assign await task to it. Refer example below
Example

public async void BtnClickEvent()
{
      Task<int> task = new Task<int>(FunctionName);
      idLabelOne.txt = await task;
}

In above example the returned text of the function will be assigned to the label.

No comments

Powered by Blogger.