Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Last active May 5, 2018 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/f63a50d1005d5812deeee2d4ae4b34df to your computer and use it in GitHub Desktop.
Save christiannagel/f63a50d1005d5812deeee2d4ae4b34df to your computer and use it in GitHub Desktop.
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