Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
readonly struct with C# 7.2
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