Last active
July 3, 2020 09:01
-
-
Save zHaytam/27eb7119d5fe35c3dda015a53e52bcaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defining a record like this | |
public record Rectangle1 { double Width; double Height; } | |
// Is equivalent to this | |
public record Rectangle1 | |
{ | |
public double Width { get; init; } | |
public double Height { get; init; } | |
} | |
// Defining a record like this | |
public record Rectangle2(double Width, double Height); | |
// Is equivalent to this | |
public record Rectangle2 | |
{ | |
public double Width { get; init; } | |
public double Height { get; init; } | |
public Rectangle2(double width, double height) | |
=> (Width, Height) = (width, height); | |
public void Deconstruct(out double width, out double height) | |
=> (width, height) = (Width, Height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment