Created
June 28, 2019 14:33
-
-
Save celiosouza2013/f3f554bbda387351d84e3bb564894d66 to your computer and use it in GitHub Desktop.
Properties, Auto Properties e ordem
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
//Ordem para implementação: | |
//Atributos privados | |
//Propriedades autoimplementadas | |
//Construtores | |
//Propriedades customizadas | |
//Outros métodos da classe | |
using System.Globalization; | |
namespace Course | |
{ | |
class Produto | |
{ | |
private string _nome; | |
public double Preco { get; private set; } | |
public double Quantidade { get; set; } | |
public Produto() | |
{ | |
} | |
public Produto(string nome, double preco, int quantidade) | |
{ | |
_nome = nome; | |
Preco = preco; | |
Quantidade = quantidade; | |
} | |
public string Nome | |
{ | |
get { return _nome; } | |
set | |
{ | |
if (value != null && value.Length > 1) | |
{ | |
_nome = value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment