C# 5.0: More Than Just Async: Listing 1.

A logging method to search for errors.

public void Run()
  Log("Running app", "Run"); ;
  Log("Complete", "Run");

public void DoSomething()
  Log("Calling CalculateTotal", "DoSomething");
  var total = CalculateTotal();
  Log("CalculateTotal returned " + total, "DoSomething");

public int CalculateTotal()
  Log("Performing calculations", "CalculateTotal");
  return 55;

About the Author

Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.

comments powered by Disqus


Subscribe on YouTube