Page 174 - CSharp/C#
P. 174

Chapter 24: C# 5.0 Features




        Syntax



            •  Async & Await

            •  public Task MyTaskAsync(){ doSomething(); }


              await MyTaskAsync();

            •  public Task<string> MyStringTaskAsync(){ return getSomeString(); }


              string MyString = await MyStringTaskAsync();

            •  Caller Information Attributes


            •  public void MyCallerAttributes(string MyMessage,

              [CallerMemberName] string MemberName = "",


              [CallerFilePath] string SourceFilePath = "",

              [CallerLineNumber] int LineNumber = 0)


            •  Trace.WriteLine("My Message: " + MyMessage);

              Trace.WriteLine("Member: " + MemberName);


              Trace.WriteLine("Source File Path: " + SourceFilePath);

              Trace.WriteLine("Line Number: " + LineNumber);



        Parameters



          Method/Modifier with Parameter         Details


          Type<T>                                T is the return type



        Remarks


        C# 5.0 is coupled with Visual Studio .NET 2012


        Examples



        Async & Await





        https://riptutorial.com/                                                                             120
   169   170   171   172   173   174   175   176   177   178   179