Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lucky Sevens - About Visual Studio 2017 and C# 7

Lucky Sevens - About Visual Studio 2017 and C# 7

Iwona Lalik

January 17, 2017
Tweet

More Decks by Iwona Lalik

Other Decks in Technology

Transcript

  1. var bigNumber = 1000000000; var bigNumber = 1_000_000_000; const int

    binNum = 0b01; const int binNum = 0b0000_0000_0000_0001;
  2. LOCAL FUNCTIONS public string GetBookInformation() { string GetAuthorInformation() { return

    string.Format($"Author: {Author.Name}" + $" {Author.Surname}"); } return GetAuthorInformation() + "\r\nTitle: {Title},\r\n" + "Publication Year: {PublicationYear},\r\n" + "Number Of Pages: {NumberOfPages}"; }
  3. TUPLES public (string Title, int PublicationYear) GetPublicationInfo() { return (Title,

    PublicationYear); } var publicationInfo = book.GetPublicationInfo(); Console.WriteLine($"Title: {publicationInfo.Title}," + $"Publication Year: {publicationInfo.PublicationYear}");
  4. var newBook = new Book() {...} switch(newBook) { case PaperBook

    b when b.NumberOfPages > 100: //some action break; case PaperBook b: //some action break; case Ebook e when e.PublicationYear > (new DateTime(2000, 1, 01)).Year: //some action break; case Ebook e: //some action break; default: //some action break; case null: throw new ArgumentNullException(nameof(newBook)); }