Skip to content

Instantly share code, notes, and snippets.

@deepumi
Created January 25, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepumi/ac2a7fa70308406b854f0856e83703fd to your computer and use it in GitHub Desktop.
Save deepumi/ac2a7fa70308406b854f0856e83703fd to your computer and use it in GitHub Desktop.
CSharp6.0 features
ExpressionBodied Methods => public string SomeMethod => "Hello world";
ConditionalAccessOperator - Elvis Operator ?. SomeMethod?.Property
AutoPropertyIntializers public List<string> Roles {get;set;} = new[] {"FFF","FF"};
Primary Constructor
class C(string a, string b)
{
public string ItemA {get;set;} = a;
public string ItemB {get;set;} = b;
}
Out parameter declaration during method call
public bool CheckValue(string value){
if(int.TryParse(value,out int newValue) && newValue > 10)
return true;
else
return false;
}
Await in the CATCH block;
Exception filters
using Static class (ex: using System.Console;)
WriteLine("Hello world");
StringInterpolation $"{dynamicValue}";
https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment