Writing Better C# Using C# 6 By: Mitchel Sellers.

Slides:



Advertisements
Similar presentations
The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Advertisements

Program Verification Using the Spec# Programming System ETAPS Tutorial K. Rustan M. Leino, Microsoft Research, Redmond Rosemary Monahan, NUIM Maynooth.
The Line Class Suppose you are involved in the development of a large mathematical application, and this application needs an object to represent a Line.
.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
CoffeeScript vs. TypeScript What should you use in your application?
Mads Torgersen Language PM for C# What’s new in C# 6.0.
Creating Single Page Applications with ASP.NET & Angular JS An introduction by Mitchel Sellers.
The Java Programming Language
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
Outline Java program structure Basic program elements
Generic Subroutines and Exceptions CS351 – Programming Paradigms.
(c) University of Washington03-1 CSC 143 Java Inheritance Reading: Ch. 10.
Evolutie vs Revolutie Chris de Kok Evolutie vs Revolutie.NET 2015.NET 4.6 ASP.NET 5 -> MVC 6 Visual Studio 2015 C# 6.0 Agenda.
11 Values and References Chapter Objectives You will be able to: Describe and compare value types and reference types. Write programs that use variables.
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Eric Vogel Software Developer A.J. Boggs & Company.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
DNN Performance & Scalability Planning, Evaluating & Improving : Part 1.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 2: Working with Visual.
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Effective Java: Generics Last Updated: Spring 2009.
Sample Application Multi Layered Architecture (n-tier): –Graphical User Interface (GUI): Forms, components, controls The Visual Designer in Visual Studio.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
Joe Hummel, the compiler is at your service Chicago Code Camp 2014.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
Polymorphism, Dynamic Typing, and Dynamic Binding Copyright © 2012 by Yong-Gu Lee
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 10 th Lecture Pavel Ježek
CreatingClasses-SlideShow-part31 Creating Classes part 3 Barb Ericson Georgia Institute of Technology Dec 2009.
Recitation 8 User Defined Classes Part 2. Class vs. Instance methods Compare the Math and String class methods that we have used: – Math.pow(2,3); – str.charAt(4);
Chapter 4 Generic Vector Class. Agenda A systemic problem with Vector of Object – Several approaches at a solution – Generic structures Converting classes.
Joe Hummel, the compiler is at your service SDC Meetup, Sept 2014.
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
IoT: Windows 10 & Raspberry Pi By: Mitchel Sellers.
C# 6 - do it right Vedran Kaldi Senior
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
.NET Mobile Application Development XML Web Services.
Support standard JavaScript code with static typing Encapsulation through classes and modules Support for constructors, properties and.
Chapter 5 Classes Essential C# Mark Michaelis Ch. 51 Excerpted from Essential C# 4.0 by Mark Michaelis (ISBN: ). Copyright 2010 Pearson Education,
Barbara Doyle Jacksonville University What’s New with Visual Studio and C#?
C# Present and Future Marita Paletsou Software Engineer.
C# 5.0 Alex Davies 22 nd December What we will cover C# 5.0,.NET 4.5, Visual Studio 11 Caller Info Attributes Upgrade from synchronous to asynchronous.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Building Web Applications with Microsoft ASP
C# and VB code-focused development with Visual Studio
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
The need for Programming Languages
Creating Your Own Classes
Upgrading Your C# Programming Skills to Be a More Effective Developer
New Features of C# Kuppurasu Nagaraj Microsoft Connect 2016
Generics, Lambdas, Reflections
Microsoft Ignite NZ October 2016 SKYCITY, Auckland.
Functional Programming with Java
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
Should I Transition to .NET Core? Will it hurt?
Exercise 11.1 Write a code fragment that performs the same function as the statement below without using the crash method Toolbox.crash(amount < 0,
ReSharper Dainius Kreivys.
Functional interface.
Developer Productivity: What’s New in C# 6
Introduction to Programming
Chapter 11 Inheritance and Polymorphism Part 1
ENERGY 211 / CME 211 Lecture 8 October 8, 2008.
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Writing Better C# Using C# 6 By: Mitchel Sellers

About Your Speaker  Mitchel Sellers  CEO/Director of Development of IowaComputerGurus, Inc  Microsoft C# MVP  DNN MVP  Contact Information    Blog:

Agenda  Quick History of C#  C# 6 Mind Blowing? Or “Just Fluff”?  Feature Listing & Detail

Quick History of C#  C# 1:.NET 1.0  C# 1.2:.NET 1.1  C# 2:.NET 2.0  Generics  C# 3:.NET 3 & 3.5  Auto-Properties  Extension Methods  Anonymous Types  C# 4:.NET 4  Named & Optional Args  C# 5:.NET 4.5  Async!

C# 6 Mind Blowing? Or Just “Fluff”  Compiler as a Service?  What does Rosyln Mean to you?  Hidden features?  Visual Studio Support & Extension Tooling?  Can you use C# 6 features when targeting <.NET 4.6?  What do you use?

using static  Adds an ability to import static classes via a using statement  Simply coding operations when working with math, files, console, etc  Math Example  var result = System.Math.Pow(5, 7); // Old Way  using static System.Math; var result = Pow(5,7);  Intellisense still shows rooting:  Far more powerful with other classes  using static System.Console  using static System.IO.Directory  Can be used with older.NET Runtimes

nameof()  Simply & Standardize reporting of errors & notifications  Better implementation IPropertyChanged  Improved argument reporting  throw new ArgumentException("Oops!", nameof(myValue));  Supports automatic refactoring within the VS tooling  Can be used on older.NET runtimes

String Interpolation  Better way of formatting strings  Old way  String.Format(“Oops {0} isn’t valid”, name);  New way  $”Ooops {name} isn’t valid”  Can use backwards compatible (BUT!!! Only for standard, not the more complex iformattable string)

Null Conditional Operator (?.)  Allows you to short-circuit calls to prevent nexting  Examples  int? nameLength = Person?.Name?.Length  Only executes the next portion in the chain if not null  If person is null returns null & short circuits  If name is null returns null & short circuits  Else returns length  Great for invoking a method  Can be used with prior.NET languages

Expression Bodied Properties & Methods  The ability to inline/create methods & properties with lambdas!  Property Example  public static string MyConfigValue => ConfigurationManager.AppSettings["Test"];  Method Example  public static void LogError(string errorMsg) => Console.WriteLIne(errorMsg);  Can be used with prior runtimes!

Auto Property Initializers & Getters  Lets you set the values as needed when you create properties  Example  public string FirstName { get; set; } = "Mitch";  public string LastName { get; } = “Sellers”;  Can be used on older.NET version

Exception Filters