lunes, 16 de noviembre de 2015

Se viene C# 7


C# 7 viene con todo. Cada vez se parece más a Scala. Vamos porque:

Pattern Matching: Ahora vamos a poder hacer en C# 7 lo siguiente:

// Moving a shape using pattern matching
void move (Shape s) {
  match (s) {
    (Rectangle r) => // Move rectangle
    (Circle c) => // Move circle
    default => // Handle default or throw
  }
}

Tuple syntax: Continuando con la mejora con respecto a pattern matching, tambien con las tuplas.

match (state, input) {
    (State.Init, Event.Go) => { // Process the input }
    (State.Init, Event.Stop) => { // Process the input}
    (_, _) => { // handle invalid state }
}

Nullable reference type: C# viene tratando a de tener una opción correcta para estos tipos, por ahora no hay un diseño claro.

Dejo link: https://github.com/dotnet/roslyn/issues/2136


No hay comentarios.:

Publicar un comentario