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

Discuss classification or taxonomy of virtualization at different levels.

Suppose that a data warehouse consists of the three dimensions time, doctor, and patient, and the two measures count and charge, where a charge is the fee that a doctor charges a patient for a visit. a) Draw a schema diagram for the above data warehouse using one of the schemas. [star, snowflake, fact constellation] b) Starting with the base cuboid [day, doctor, patient], what specific OLAP operations should be performed in order to list the total fee collected by each doctor in 2004? c) To obtain the same list, write an SQL query assuming the data are stored in a relational database with the schema fee (day, month, year, doctor, hospital, patient, count, charge)

Explain cloud computing reference model .