Skip to content

Instantly share code, notes, and snippets.

Last active Oct 13, 2020
What would you like to do?
Record with static helper
using System;
var weight = 200;
WeightMeasurement measurement = new(DateTime.Now, weight)
Pounds = WeightMeasurement.GetPounds(weight)
public record WeightMeasurement(DateTime Date, double Kilograms)
public double Pounds {get; init;}
public static double GetPounds(double kilograms) => kilograms * 2.20462262;
<Project Sdk="Microsoft.NET.Sdk">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment