c# - Good class design by example - Stack Overflow
stackoverflow.com › questions › 6125351May 25, 2011 · Good class design by example. I am trying to work out the best way to design a class that has its properties persisted in a database. Let's take a basic example of a Person. To create a new person and place it in the database, I want the DateOfBirth property to be optional (i.e. NULLable in the DB). namespace BusinessLayer { class Person ...
class - Design classes in C# - Stack Overflow
stackoverflow.com › questions › 22787349Apr 01, 2014 · Design classes in C#. Recently I had attended an interview and was given this question: The best I could do was this: class Shirt : Fabric { Buttons buttons {get;set;} //Inherits all Fabric methods MakeShirt () { //make a shirt here } } class Pant : Fabric { Buttons buttons {get;set;} // Inherits all Fabric methods MakePant () { //Make a pant here } } class Fabric { private MaterialType materialType {get;set;} private FabricType fabricType {get;set;} Fabric (MaterialType ...
C# Class Design Features - Juniata College
jcsites.juniata.edu › faculty › rhodesJul 28, 2020 · C# Class Design Features C# Class Design Features last updated 7/28/20 These topics are highlights from Deitel Section 4.5-4.9. Properties When designing a class, you often set up accessor and modifier functions to essentially "get" the private variable value and "set" the private variable. E.g. Pos.GetXCoord () and Pos.SetXCoord (float x)