5.1.1 Use Automatic Properties

master
Jason Zhu 2021-07-05 15:38:10 +10:00
parent ddbaeaa84f
commit d848d67310
1 changed files with 6 additions and 1 deletions

View File

@ -21,11 +21,16 @@ namespace automatically_implemented_properties
public class Product public class Product
{ {
private string name; private string name;
public int ProductID { get; set; }
public string Name public string Name
{ {
get { return name; } get { return ProductID + name; }
set { name = value; } set { name = value; }
} }
public string Description { get; set; }
public decimal Price { get; set; }
public string Category { set; get; }
} }
} }