Saturday, April 15, 2017
























By using automatic properties, I save myself some typing, create code that is easier to read but still preserves the flexibility that a
property provides. If the day comes when I need to change the way a property is implemented, I can return to the regular
property format. As a demonstration, Listing 4-7 shows what I would have to do if I needed to change the way the Name
property is composed.

Create and populate product in 2 ways 

the first one 

the second way 

















Initializing Collections and Arrays in the HomeController.cs File


The listing demonstrates how to construct and initialize an array and two classes from the generic collection library. 
This feature is a syntax convenience—it just makes C# more pleasant to use but does not have any other impact or benefit.


No comments:

Post a Comment