16/04/2014
C # most recent version 5.0 was released on August 15, 2012 with .NET Framework 4.5 and Visual Studio 2012. There are two main features in C # 5.0 - Async Programming and Caller Information.
1.Async Feature
Two new key words are used for Async feature: async modifier and await operator. Method marked
with async modifier is called async method. This new feature will help us a lot in async programming.
For example, in the programming of Winform, the UI thread will be blocked while we use
HttpWebRequest synchronously request any resource in the Internet. From the perspective of user
experience, we cannot interact with the form before the request is done.
2.Caller Information
Caller Information can help us in tracing, debugging and creating diagnose tools. It will help us
to avoid duplicate codes which are generally invoked in many methods for same purpose, such
as logging and tracing.
We could get the below information of caller method :
CallerFilePathAttribute Full path of the source
file that contains the caller. This is the file path at compile time.
CallerLineNumberAttribute Line number in the
source file at which the method is called.
CallerMemberNameAttribute Method or property
name of the caller.