diff --git a/chap5_essential_language_features/automatically_implemented_properties/Program.cs b/chap5_essential_language_features/automatically_implemented_properties/Program.cs index c58a3da..4b00042 100644 --- a/chap5_essential_language_features/automatically_implemented_properties/Program.cs +++ b/chap5_essential_language_features/automatically_implemented_properties/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; namespace automatically_implemented_properties { @@ -10,11 +11,19 @@ namespace automatically_implemented_properties Product myProduct = new Product(); // set the property value + myProduct.ProductID = 100; myProduct.Name = "Kayak"; + myProduct.Description = "A boat for one person"; + myProduct.Price = 275M; + myProduct.Category = "Watersports"; - // get the property - string produtName = myProduct.Name; - Console.WriteLine("Product name: {0}", produtName); + // process the property + ProcessProduct(myProduct); + } + + private static void ProcessProduct(Product prodParam) + { + // ... statements to process product in some way } }