embed embed share link link comment comment

Embed This Video close
Share This Video close
bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark
embed test
Rate This Video embed
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Tags For This Video tags
rate rate tags tags related related lights lights

What’s new in C# 7

Speaker:

Reaz Haq

Abstract:

Released just a few weeks ago (March 7, 2017, along with new version of VS), C# 7 brings some new and interesting features; like tuple, pattern matching, etc.  In this talk, I shall ‘show and tell’ some of these new features [with code examples], as well as few interesting ones that didn’t make the final cut. Sample code at https://github.com/reazhaq/CSharp7

Bio:

Geek and Independent Consultant with over 20 years of experiance

Recorded At:

Austin .NET User Group

4 Responses to “What’s new in C# 7”

  1. reaz says:

    /////// DURING THIS TALK AT AUSTIN .NET USER GROUP
    /////// SOMEONE HAD ASKED WHAT OTHER WAYS TO DECLARE RETURN VARIABLE INSTEAD OF ‘var’
    /////// HERE ARE FEW EXAMPLES
    //// ValueTuple is one simple way
    ValueTuple blah = CalculateSumAndCount3(someNumbers);
    Console.WriteLine($”blah.Item1 = {blah.Item1}”);
    //// (int, int) is another choice
    (int, int) blah2 = CalculateSumAndCount3(someNumbers);
    Console.WriteLine($”blah2.Item1 = {blah2.Item1}”);
    //// let’s say we don’t need the 2nd part of the tuple; use wildcard
    var (s2, _) = CalculateSumAndCount3(someNumbers);
    Console.WriteLine($”var (s2, _) -> s2={s2}”);

    ////// another correction regarding out variable and wildcard
    /////// FOR WILDCARD USE UNDERSCORE NOT *
    if (int.TryParse(someNumberAsAString, out _))
    Console.WriteLine($”\”{someNumberAsAString}\” was parsed -> …”);

  2. reaz says:

    Sample code (GitHub) have been updated
    https://github.com/reazhaq/CSharp7

  3. reaz says:

    Updated GitHub with correct wildcard (out variable) code; updated tuple code with additional declaration formats.

  4. reaz says:

    Made some correction to the sample code; like wildcard out variable, etc. At the time of this talk, I used ‘*’; but it got implemented as ‘_’. Style is similar when one needs to ignore part of tuple.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>