Skip to content

Instantly share code, notes, and snippets.

@renatogroffe
Created November 21, 2024 11:46
Show Gist options
  • Save renatogroffe/09d8ab06b8b1adfe45496b2c893397b8 to your computer and use it in GitHub Desktop.
Save renatogroffe/09d8ab06b8b1adfe45496b2c893397b8 to your computer and use it in GitHub Desktop.
namespace ConsoleAppFieldKeyword.Models;
public class Temperatura
{
private double _fahrenheit;
public double Fahrenheit
{
get => _fahrenheit;
set
{
if (value < -459.67)
throw new ArgumentOutOfRangeException(
$"Valor de temperatura em Fahrenheit invalido: {value}");
_fahrenheit = value;
}
}
public double Celsius
{
get => (Fahrenheit - 32) * 5 / 9;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment