Created
November 21, 2024 12:07
-
-
Save renatogroffe/f03f35ea8e7f43c898400d7f107c3deb 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 | |
{ | |
public double Fahrenheit | |
{ | |
get; | |
set | |
{ | |
if (value < -459.67) | |
throw new ArgumentOutOfRangeException( | |
$"Valor de temperatura em Fahrenheit invalido: {value}"); | |
field = 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