Define Asynchronous programming techniques with examples of async/ wait functions.

 Asynchronous programming techniques

  • Asynchronous programming in C# is an efficient approach towards activities blocked or access is delayed.
  • If an activity is blocked in a synchronous then, the complete application waits and it takes more time. By using the asynchronous approach the applications continue with other ' tasks as well.'
  • The async and await keywords in C# are used in async programming. Using them, we can work with .Net resources, .Net Core, etc.

Example:

using System;

using System. Threading. Tasks;

namespace My Console App

{

 Class Async Await Test 

{

 Static void Main (string [ ]args)

{

 Method1(); 

Method 2(); 

Console. ReadKey ();

public static async Task Method1()

await Task.Run(() => 

{

 for(int & i= 0; i ≤ 100; i++) 

Console Write Line ("Methed 1");

}

});

}

 public static void Method 2 

{

 for (int i=0; i <25, i++)

{

Console.WriteLine (Method 2"); 

}

}

}

}

Comments

Popular posts from this blog

Suppose that a data warehouse consists of the four dimensions; date, spectator, location, and game, and the two measures, count and charge, where charge is the fee that a spectator pays when watching a game on a given date. Spectators may be students, adults, or seniors, with each category having its own charge rate. a) Draw a star schema diagram for the data b) Starting with the base cuboid [date; spectator; location; game], what specific OLAP operations should perform in order to list the total charge paid by student spectators at GM Place in 2004?

Define Business ethics . Explain its significance.

Short Note on Security Architecture of E-governance