Last active
May 5, 2018 21:32
-
-
Save christiannagel/f63a50d1005d5812deeee2d4ae4b34df to your computer and use it in GitHub Desktop.
readonly struct with C# 7.2
This file contains 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
public readonly struct Dimensions | |
{ | |
public double Length { get; } | |
public double Width { get; } | |
public Dimensions(double length, double width) | |
{ | |
Length = length; | |
Width = width; | |
} | |
public double Diagonal => Math.Sqrt(Length * Length + Width * Width); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment