Skip to content
Bassam Alugili edited this page Jan 27, 2017 · 11 revisions

#Welcome to the CSharp7Features wiki!

C# 7 in Core

Binary Literals & Digits Separators

New langauge Syntax to improve readability for numeric constants.

int binary = 0b1001_1010_1001_0100;
int hex = 0x1c_a0_41_fe;
double real = 1_00.99_9e-1_000;

Out variables

Declare out variablie inline.

public static void OutVarTest(string @int)
{
  int.TryParse(@int, out int t);
  Console.WriteLine(t);
}

Local Functions

Nesting functions inside other functions to limit their scope and visibility.

  • Better performance

  • Reduced memory pressure

    public static void BasicExample() { // Lambda Function Action lambdaFun = () => Console.WriteLine("I'm Lambda"); lambdaFun.Invoke(); // Local Functions Basic void EmptyLocalFunction() { Console.WriteLine("I'm Local"); }; EmptyLocalFunction(); }


Clone this wiki locally