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