Created
November 21, 2024 11:46
-
-
Save renatogroffe/09d8ab06b8b1adfe45496b2c893397b8 to your computer and use it in GitHub Desktop.
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
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