├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── main.yml
├── .gitignore
├── CONTRIBUTING.md
├── Finished
├── Ch1
│ ├── AccessModifiers
│ │ ├── AccessModifiers.csproj
│ │ ├── Modifiers.cs
│ │ └── Program.cs
│ ├── AnonTypes
│ │ ├── AnonTypes.csproj
│ │ └── Program.cs
│ ├── DefineClasses
│ │ ├── Program.cs
│ │ ├── classes.csproj
│ │ └── shapes.cs
│ ├── Inheritance
│ │ ├── Inheritance.csproj
│ │ ├── Program.cs
│ │ └── shapes.cs
│ └── PropsMethods
│ │ ├── Program.cs
│ │ ├── PropsMethods.csproj
│ │ └── shapes.cs
├── Ch2
│ ├── Challenge
│ │ ├── Challenge.csproj
│ │ ├── Employees.cs
│ │ └── Program.cs
│ ├── InitProps
│ │ ├── InitExample.cs
│ │ ├── InitProps.csproj
│ │ └── Program.cs
│ ├── ObjectInitializers
│ │ ├── Initializers.cs
│ │ ├── ObjectInitializers.csproj
│ │ └── Program.cs
│ ├── ReadonlyProps
│ │ ├── Program.cs
│ │ ├── ReadOnly.cs
│ │ └── ReadonlyProps.csproj
│ └── RequiredProps
│ │ ├── Program.cs
│ │ ├── RequiredExample.cs
│ │ └── RequiredProps.csproj
├── Ch3
│ ├── Challenge
│ │ ├── Challenge.csproj
│ │ ├── Employees.cs
│ │ └── Program.cs
│ ├── StaticClasses
│ │ ├── Program.cs
│ │ ├── StaticClass.cs
│ │ └── StaticClasses.csproj
│ ├── StaticConstructor
│ │ ├── MyClass.cs
│ │ ├── Program.cs
│ │ └── StaticConstructor.csproj
│ └── StaticMethods
│ │ ├── Program.cs
│ │ ├── StaticMethods.cs
│ │ └── StaticMethods.csproj
└── Ch4
│ ├── AbstractClasses
│ ├── AbstractClasses.csproj
│ ├── Program.cs
│ └── Vehicles.cs
│ ├── AbstractPropsFuncs
│ ├── AbstractPropsFuncs.csproj
│ ├── Program.cs
│ └── Vehicles.cs
│ ├── Challenge
│ ├── Challenge.csproj
│ ├── Employees.cs
│ └── Program.cs
│ └── SealedClasses
│ ├── Program.cs
│ ├── SealedClasses.csproj
│ └── SealedExample.cs
├── LICENSE
├── NOTICE
├── README.md
├── Start
├── Ch1
│ ├── AccessModifiers
│ │ ├── AccessModifiers.csproj
│ │ ├── Modifiers.cs
│ │ └── Program.cs
│ ├── AnonTypes
│ │ ├── AnonTypes.csproj
│ │ └── Program.cs
│ ├── DefineClasses
│ │ ├── Program.cs
│ │ ├── classes.csproj
│ │ └── shapes.cs
│ ├── Inheritance
│ │ ├── Inheritance.csproj
│ │ ├── Program.cs
│ │ └── shapes.cs
│ └── PropsMethods
│ │ ├── Program.cs
│ │ ├── PropsMethods.csproj
│ │ └── shapes.cs
├── Ch2
│ ├── Challenge
│ │ ├── Challenge.csproj
│ │ ├── Employees.cs
│ │ └── Program.cs
│ ├── InitProps
│ │ ├── InitExample.cs
│ │ ├── InitProps.csproj
│ │ └── Program.cs
│ ├── ObjectInitializers
│ │ ├── Initializers.cs
│ │ ├── ObjectInitializers.csproj
│ │ └── Program.cs
│ ├── ReadonlyProps
│ │ ├── Program.cs
│ │ ├── ReadOnly.cs
│ │ └── ReadonlyProps.csproj
│ └── RequiredProps
│ │ ├── Program.cs
│ │ ├── RequiredExample.cs
│ │ └── RequiredProps.csproj
├── Ch3
│ ├── Challenge
│ │ ├── Challenge.csproj
│ │ ├── Employees.cs
│ │ └── Program.cs
│ ├── StaticClasses
│ │ ├── Program.cs
│ │ ├── StaticClass.cs
│ │ └── StaticClasses.csproj
│ ├── StaticConstructor
│ │ ├── MyClass.cs
│ │ ├── Program.cs
│ │ └── StaticConstructor.csproj
│ └── StaticMethods
│ │ ├── Program.cs
│ │ ├── StaticMethods.cs
│ │ └── StaticMethods.csproj
└── Ch4
│ ├── AbstractClasses
│ ├── AbstractClasses.csproj
│ ├── Program.cs
│ └── Vehicles.cs
│ ├── AbstractPropsFuncs
│ ├── AbstractPropsFuncs.csproj
│ ├── Program.cs
│ └── Vehicles.cs
│ ├── Challenge
│ ├── Challenge.csproj
│ ├── Employees.cs
│ └── Program.cs
│ └── SealedClasses
│ ├── Program.cs
│ ├── SealedClasses.csproj
│ └── SealedExample.cs
└── c-sharp-advanced-object-oriented-programming-4406346.sln
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Codeowners for these exercise files:
2 | # * (asterisk) denotes "all files and folders"
3 | # Example: * @producer @instructor
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | ## Issue Overview
9 |
10 |
11 | ## Describe your environment
12 |
13 |
14 | ## Steps to Reproduce
15 |
16 | 1.
17 | 2.
18 | 3.
19 | 4.
20 |
21 | ## Expected Behavior
22 |
23 |
24 | ## Current Behavior
25 |
26 |
27 | ## Possible Solution
28 |
29 |
30 | ## Screenshots / Video
31 |
32 |
33 | ## Related Issues
34 |
35 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: Copy To Branches
2 | on:
3 | workflow_dispatch:
4 | jobs:
5 | copy-to-branches:
6 | runs-on: ubuntu-latest
7 | steps:
8 | - uses: actions/checkout@v2
9 | with:
10 | fetch-depth: 0
11 | - name: Copy To Branches Action
12 | uses: planetoftheweb/copy-to-branches@v1.2
13 | env:
14 | key: main
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Apple
2 | *.DS_Store
3 |
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | # Log Files
29 | *.log
30 |
31 | # Android Studio Navigation editor temp files
32 | .navigation/
33 |
34 | # Android Studio captures folder
35 | captures/
36 |
37 | # Google Doc files
38 | *.gsheet
39 | *.gslides
40 | *.gdoc
41 |
42 | # MS Office files
43 | *.xls_
44 | *.doc_
45 | *.ppt_
46 |
47 | # PDF files
48 | *.pdf
49 |
50 | # ZIP files
51 | *.zip
52 |
53 | # VISUAL STUDIO FILES
54 |
55 | # User-specific files
56 | *.suo
57 | *.user
58 | *.userosscache
59 | *.sln.docstates
60 |
61 | # User-specific files (MonoDevelop/Xamarin Studio)
62 | *.userprefs
63 |
64 | # Build results
65 | [Dd]ebug/
66 | [Dd]ebugPublic/
67 | [Rr]elease/
68 | [Rr]eleases/
69 | x64/
70 | x86/
71 | bld/
72 | [Bb]in/
73 | [Oo]bj/
74 | [Ll]og/
75 | __pycache__/
76 |
77 | # Visual Studio 2015 cache/options directory
78 | .vs/
79 | # Uncomment if you have tasks that create the project's static files in wwwroot
80 | #wwwroot/
81 |
82 | # MSTest test Results
83 | [Tt]est[Rr]esult*/
84 | [Bb]uild[Ll]og.*
85 |
86 | # NUNIT
87 | *.VisualState.xml
88 | TestResult.xml
89 |
90 | # Build Results of an ATL Project
91 | [Dd]ebugPS/
92 | [Rr]eleasePS/
93 | dlldata.c
94 |
95 | # DNX
96 | project.lock.json
97 | artifacts/
98 |
99 | *_i.c
100 | *_p.c
101 | *_i.h
102 | *.ilk
103 | *.meta
104 | *.obj
105 | *.pch
106 | *.pdb
107 | *.pgc
108 | *.pgd
109 | *.rsp
110 | *.sbr
111 | *.tlb
112 | *.tli
113 | *.tlh
114 | *.tmp
115 | *.tmp_proj
116 | *.log
117 | *.vspscc
118 | *.vssscc
119 | .builds
120 | *.pidb
121 | *.svclog
122 | *.scc
123 |
124 | # Chutzpah Test files
125 | _Chutzpah*
126 |
127 | # Visual C++ cache files
128 | ipch/
129 | *.aps
130 | *.ncb
131 | *.opendb
132 | *.opensdf
133 | *.sdf
134 | *.cachefile
135 | *.VC.db
136 | *.VC.VC.opendb
137 |
138 | # Visual Studio profiler
139 | *.psess
140 | *.vsp
141 | *.vspx
142 | *.sap
143 |
144 | # TFS 2012 Local Workspace
145 | $tf/
146 |
147 | # Guidance Automation Toolkit
148 | *.gpState
149 |
150 | # ReSharper is a .NET coding add-in
151 | _ReSharper*/
152 | *.[Rr]e[Ss]harper
153 | *.DotSettings.user
154 |
155 | # JustCode is a .NET coding add-in
156 | .JustCode
157 |
158 | # TeamCity is a build add-in
159 | _TeamCity*
160 |
161 | # DotCover is a Code Coverage Tool
162 | *.dotCover
163 |
164 | # NCrunch
165 | _NCrunch_*
166 | .*crunch*.local.xml
167 | nCrunchTemp_*
168 |
169 | # MightyMoose
170 | *.mm.*
171 | AutoTest.Net/
172 |
173 | # Web workbench (sass)
174 | .sass-cache/
175 |
176 | # Installshield output folder
177 | [Ee]xpress/
178 |
179 | # DocProject is a documentation generator add-in
180 | DocProject/buildhelp/
181 | DocProject/Help/*.HxT
182 | DocProject/Help/*.HxC
183 | DocProject/Help/*.hhc
184 | DocProject/Help/*.hhk
185 | DocProject/Help/*.hhp
186 | DocProject/Help/Html2
187 | DocProject/Help/html
188 |
189 | # Click-Once directory
190 | publish/
191 |
192 | # Publish Web Output
193 | *.[Pp]ublish.xml
194 | *.azurePubxml
195 | # TODO: Comment the next line if you want to checkin your web deploy settings
196 | # but database connection strings (with potential passwords) will be unencrypted
197 | *.pubxml
198 | *.publishproj
199 |
200 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
201 | # checkin your Azure Web App publish settings, but sensitive information contained
202 | # in these scripts will be unencrypted
203 | PublishScripts/
204 |
205 | # NuGet Packages
206 | *.nupkg
207 | # The packages folder can be ignored because of Package Restore
208 | **/packages/*
209 | # except build/, which is used as an MSBuild target.
210 | !**/packages/build/
211 | # Uncomment if necessary however generally it will be regenerated when needed
212 | #!**/packages/repositories.config
213 | # NuGet v3's project.json files produces more ignoreable files
214 | *.nuget.props
215 | *.nuget.targets
216 |
217 | # Microsoft Azure Build Output
218 | csx/
219 | *.build.csdef
220 |
221 | # Microsoft Azure Emulator
222 | ecf/
223 | rcf/
224 |
225 | # Windows Store app package directories and files
226 | AppPackages/
227 | BundleArtifacts/
228 | Package.StoreAssociation.xml
229 | _pkginfo.txt
230 |
231 | # Visual Studio cache files
232 | # files ending in .cache can be ignored
233 | *.[Cc]ache
234 | # but keep track of directories ending in .cache
235 | !*.[Cc]ache/
236 |
237 | # Others
238 | ClientBin/
239 | ~$*
240 | *~
241 | *.dbmdl
242 | *.dbproj.schemaview
243 | *.pfx
244 | *.publishsettings
245 | node_modules/
246 | orleans.codegen.cs
247 |
248 | # Since there are multiple workflows, uncomment next line to ignore bower_components
249 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
250 | #bower_components/
251 |
252 | # RIA/Silverlight projects
253 | Generated_Code/
254 |
255 | # Backup & report files from converting an old project file
256 | # to a newer Visual Studio version. Backup files are not needed,
257 | # because we have git ;-)
258 | _UpgradeReport_Files/
259 | Backup*/
260 | UpgradeLog*.XML
261 | UpgradeLog*.htm
262 |
263 | # SQL Server files
264 | *.mdf
265 | *.ldf
266 |
267 | # Business Intelligence projects
268 | *.rdl.data
269 | *.bim.layout
270 | *.bim_*.settings
271 |
272 | # Microsoft Fakes
273 | FakesAssemblies/
274 |
275 | # GhostDoc plugin setting file
276 | *.GhostDoc.xml
277 |
278 | # Node.js Tools for Visual Studio
279 | .ntvs_analysis.dat
280 |
281 | # Visual Studio 6 build log
282 | *.plg
283 |
284 | # Visual Studio 6 workspace options file
285 | *.opt
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # JetBrains Rider
303 | .idea/
304 | *.sln.iml
305 |
306 | # VS Code folder
307 | .vscode/
308 |
309 | # Databricks file
310 | *.pyi
311 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | Contribution Agreement
3 | ======================
4 |
5 | This repository does not accept pull requests (PRs). All pull requests will be closed.
6 |
7 | However, if any contributions (through pull requests, issues, feedback or otherwise) are provided, as a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer). By submitting code (or otherwise providing feedback), you (and, if applicable, your employer) are licensing the submitted code (and/or feedback) to LinkedIn and the open source community subject to the BSD 2-Clause license.
8 |
--------------------------------------------------------------------------------
/Finished/Ch1/AccessModifiers/AccessModifiers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch1/AccessModifiers/Modifiers.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | public class MyClass {
4 | public MyClass() {}
5 |
6 | // public members can be accessed from any other class
7 | public void Func1() {
8 | Console.WriteLine("This is Func1");
9 | SomeValue += 1;
10 | }
11 |
12 | // protected members can be accessed only from this class or derived classes
13 | protected void Func2() {
14 | Console.WriteLine("This is Func2");
15 | SomeValue -= 1;
16 | }
17 |
18 | // private members can only be accessed by this class
19 | private int SomeValue = 1;
20 |
21 | // Prperties often expose internal data, so they are usually public
22 | public int Data {
23 | get => SomeValue;
24 | set => SomeValue = value;
25 | }
26 | }
27 |
28 | public class DerivedClass : MyClass {
29 | public DerivedClass() {}
30 |
31 | public void Func3() {
32 | Console.WriteLine("This is Func3");
33 | // TODO: Func2 can be accessed because this is a subclass of MyClass
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Finished/Ch1/AccessModifiers/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Access modifiers
3 |
4 | // create the classes
5 | MyClass class1 = new MyClass();
6 | DerivedClass class2 = new DerivedClass();
7 |
8 | // Access the methods
9 | Console.WriteLine($"Class1 Data value is {class1.Data}");
10 | class1.Func1();
11 | class1.Func1();
12 | Console.WriteLine($"Class1 Data value is {class1.Data}");
13 |
14 | // class2.Func2(); // can't access this function outside the class
15 | Console.WriteLine($"Class2 Data value is {class2.Data}");
16 | class2.Func1();
17 | class2.Func3();
18 | Console.WriteLine($"Class2 Data value is {class2.Data}");
19 |
--------------------------------------------------------------------------------
/Finished/Ch1/AnonTypes/AnonTypes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch1/AnonTypes/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Creating and using Anonymous types
3 |
4 | // Anonymous types can be declared using "new" and { }, similar to JS
5 | var myobj = new {
6 | Name = "John Doe",
7 | Age= 45,
8 | Address = new {
9 | Street = "123 Main Street",
10 | City = "Anywhere",
11 | }
12 | };
13 |
14 | Console.WriteLine($"{myobj.Name}, {myobj.Address.Street}");
15 | Console.WriteLine($"{myobj}");
16 |
17 | // Anonymous types are read-only and cannot be modified
18 | // myobj.Name = "Jane Doe"; # will cause an error
19 |
20 | // To change a value, use non-destructive mutation and "with" clause
21 | var myobj2 = myobj with {Name = "Jane Doe"};
22 | Console.WriteLine($"{myobj2.Name}, {myobj2.Address.Street}");
23 |
24 | // You can check to see if an anonymous object contains a property
25 | Console.WriteLine($"{myobj.GetType().GetProperty("Name") != null}");
26 | Console.WriteLine($"{myobj.GetType().GetProperty("Job") != null}");
27 |
--------------------------------------------------------------------------------
/Finished/Ch1/DefineClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining and instantiating classes
3 |
4 | // Create some new Rectangle objects with dimensions
5 | Rectangle rect1 = new Rectangle(10,20);
6 | Rectangle rect2 = new Rectangle(30);
7 |
8 | Console.WriteLine(rect1.GetArea());
9 | Console.WriteLine(rect2.GetArea());
10 |
11 | // Change the values of width and height
12 | rect2.width = 5;
13 | rect2.height = 7;
14 | Console.WriteLine(rect2.GetArea());
15 |
--------------------------------------------------------------------------------
/Finished/Ch1/DefineClasses/classes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch1/DefineClasses/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining and instantiating classes
3 |
4 | // Define a class using the "class" keyword
5 | class Rectangle {
6 | // The constructor accepts parameters used to create the object
7 | public Rectangle(int w, int h) {
8 | width = w;
9 | height = h;
10 | }
11 |
12 | // For convenience, we can have a constructor that takes one value
13 | // for squares that have the same side size
14 | public Rectangle(int side) {
15 | width = height = side;
16 | }
17 |
18 | // Classes can define methods that return values
19 | public int GetArea() {
20 | return width * height;
21 | }
22 |
23 | // Member variables hold data
24 | public int width;
25 | public int height;
26 | }
27 |
--------------------------------------------------------------------------------
/Finished/Ch1/Inheritance/Inheritance.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch1/Inheritance/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using inheritance to define a class hierarchy
3 |
4 | // Instantiate some objects
5 | Circle c = new Circle(10);
6 | Rectangle r = new Rectangle(10,20);
7 | Square s = new Square(10);
8 |
9 | // Exercise the ToString() method
10 | Console.WriteLine($"{c}");
11 | Console.WriteLine($"{r}");
12 |
13 | // Use the "is" operator to test an object type
14 | Console.WriteLine($"{c is Shape2D}");
15 | Console.WriteLine($"{c is Rectangle}");
16 |
17 | // Call the GetArea() function on each one
18 | Console.WriteLine(c.GetArea());
19 | Console.WriteLine(r.GetArea());
20 | Console.WriteLine(s.GetArea());
21 |
22 | // Print the area of each shape
23 | PrintArea(c);
24 | PrintArea(r);
25 | PrintArea(s);
26 |
27 | // All of the classes derive from Shape2D, so we can treat each one
28 | // as an instance of the base class.
29 | void PrintArea(Shape2D shape) {
30 | Console.WriteLine($"{shape.GetArea()}");
31 | }
32 |
--------------------------------------------------------------------------------
/Finished/Ch1/Inheritance/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using inheritance to define a class hierarchy
3 |
4 | // Define a base class that represents the concept of a 2-dimensional shape
5 | class Shape2D {
6 | public Shape2D() {}
7 |
8 | // Methods must be marked as "virtual" to allow overriding
9 | public virtual float GetArea() {
10 | return 0.0f;
11 | }
12 |
13 | // All classes in .NET derive from Object, so we get some methods for free
14 | // ToString() returns a string representation of the object
15 | // GetType() returns the type of the object
16 | public override string ToString() => $"This object is a '{GetType()}'";
17 | }
18 |
19 | // Derive a Circle class that inherits from the base Shape2D
20 | class Circle : Shape2D {
21 | public Circle(int r) {
22 | radius = r;
23 | }
24 |
25 | // Override the GetArea() function for the Circle
26 | public override float GetArea() {
27 | return 3.14f * (radius * radius);
28 | }
29 |
30 | int radius;
31 | }
32 |
33 | // Derive a Rectangle class that inherits from the base Shape2D
34 | class Rectangle : Shape2D {
35 | public Rectangle(int w, int h) {
36 | width = w;
37 | height = h;
38 | }
39 |
40 | // Override the GetArea() function for the Rectangle
41 | public override float GetArea() {
42 | return width * height;
43 | }
44 |
45 | int width;
46 | int height;
47 | }
48 |
49 | // Derive a Square class that inherits from the base Rectangle
50 | class Square : Rectangle {
51 | // use the base keyword to initialize the superclass
52 | public Square(int side) : base(side, side) {}
53 |
54 | // No need to override GetArea, the base version works fine
55 | }
56 |
--------------------------------------------------------------------------------
/Finished/Ch1/PropsMethods/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | // Create some rectangle objects
4 | Rectangle rect1 = new Rectangle(10,20);
5 | Rectangle rect2 = new Rectangle(30);
6 |
7 | Console.WriteLine(rect1.GetArea());
8 | Console.WriteLine(rect2.GetArea());
9 |
10 | // Operate on the Properties
11 | rect1.BorderSize = 5;
12 | Console.WriteLine($"{rect1.BorderSize}");
13 | rect1.Width = 5;
14 | rect2.Height = 6;
15 | Console.WriteLine(rect1.GetArea());
16 |
17 | // Try setting an invalid value
18 | rect1.Height = -30;
19 |
--------------------------------------------------------------------------------
/Finished/Ch1/PropsMethods/PropsMethods.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch1/PropsMethods/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining and instantiating classes
3 |
4 | // Define a class using the "class" keyword
5 | class Rectangle {
6 | // The constructor accepts parameters used to create the object
7 | public Rectangle(int w, int h) {
8 | width = w;
9 | height = h;
10 | }
11 |
12 | // For convenience, we can have a constructor that takes one value
13 | // for squares that have the same side size
14 | public Rectangle(int side) {
15 | width = height = side;
16 | }
17 |
18 | // Classes can define methods that return values
19 | public int GetArea() {
20 | return width * height;
21 | }
22 |
23 | // Define Properties that allow access to the private data
24 | // These are called "backing field" properties
25 | public int Width {
26 | get { return width; }
27 | set { width = value; }
28 | }
29 | public int Height {
30 | get { return height; }
31 | set {
32 | if (value < 0) {
33 | throw new ArgumentOutOfRangeException("Height", "must be >= 0");
34 | }
35 | height = value;
36 | }
37 | }
38 |
39 | // Auto-implmeneted properties don't have a backing field
40 | public int BorderSize { get; set; } = 1;
41 |
42 | // Properties and member variables hold data
43 | int width;
44 | int height;
45 | }
46 |
--------------------------------------------------------------------------------
/Finished/Ch2/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch2/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public class Employee {
5 | public Employee() {}
6 |
7 | public required int ID {get; init;}
8 | public required string Department {get; set;}
9 | public required string FullName {get; set;}
10 |
11 | public virtual void AdjustPay(decimal percentage) {}
12 |
13 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
14 | }
15 |
16 | public class HourlyEmployee : Employee {
17 | public HourlyEmployee() {}
18 |
19 | public decimal PayRate {get; set;}
20 |
21 | public override void AdjustPay(decimal percentage)
22 | {
23 | PayRate += (PayRate * percentage);
24 | }
25 | }
26 |
27 | public class SalariedEmployee : Employee {
28 | public SalariedEmployee() {}
29 |
30 | public decimal Salary {get; set;}
31 |
32 | public override void AdjustPay(decimal percentage) {
33 | Salary += (Salary * percentage);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Finished/Ch2/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: create a class hierarchy to represent employees
3 |
4 | // Test code for the programming challenge
5 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", ID=1, PayRate=35.0m};
6 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", ID=2, Salary=75000.0m};
7 |
8 | Console.WriteLine($"{Emp1} -- {Emp1.PayRate:C2}");
9 | Emp1.Department = "Legal";
10 | Emp1.AdjustPay(0.10m);
11 | Console.WriteLine($"{Emp1} -- {Emp1.PayRate:C2}");
12 |
13 | Console.WriteLine("-------------------");
14 |
15 | Console.WriteLine($"{Emp2} -- {Emp2.Salary:C2}");
16 | Emp2.Department = "Solution Architecture";
17 | Emp2.AdjustPay(0.07m);
18 | Console.WriteLine($"{Emp2} -- {Emp2.Salary:C2}");
19 |
--------------------------------------------------------------------------------
/Finished/Ch2/InitProps/InitExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // init-only modifier
3 |
4 | public class Employee {
5 | private readonly int _id;
6 |
7 | public Employee() {}
8 |
9 | public Employee(string fname, string lname, int id, string dept) {
10 | FirstName = fname;
11 | LastName = lname;
12 | ID = id;
13 | Department = dept;
14 | }
15 |
16 | // This causes a compile error since ID is being changed outside of construction
17 | // public void ChangeID(int NewID) {
18 | // ID = NewID;
19 | // }
20 |
21 | // The init keyword means that a value is assigned only during construction
22 | public int ID {
23 | get => _id;
24 | init => _id = value;
25 | }
26 | public string? Department {
27 | get; set;
28 | }
29 | public string? FirstName {
30 | get; set;
31 | }
32 | public string? LastName {
33 | get; set;
34 | }
35 |
36 | public override string ToString() => $"{FirstName} {LastName}, ID:{ID} in {Department}";
37 | }
38 |
--------------------------------------------------------------------------------
/Finished/Ch2/InitProps/InitProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch2/InitProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // init-only modifier
3 |
4 | // create two objects using Initializers and a Constructor
5 | Employee emp1 = new Employee() {FirstName="John", LastName="Doe", ID=1, Department="Sales"};
6 | Employee emp2 = new Employee("Jane", "Deaux", 2, "Sales");
7 |
8 |
9 | Console.WriteLine(emp1);
10 | emp1.Department = "Tech Support";
11 | // emp1.ID = 5; // Will cause a compile error
12 | Console.WriteLine(emp1);
13 |
14 | Console.WriteLine(emp2);
15 | emp2.LastName = "Dough";
16 | // emp2.ID = 3; // also fails
17 | Console.WriteLine(emp2);
18 |
--------------------------------------------------------------------------------
/Finished/Ch2/ObjectInitializers/Initializers.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using object initializers
3 |
4 | // Example: class that defines a Pet with a name and age
5 | public class Pet {
6 | public string Name { get; set; } = "";
7 | public int Age { get; set; } = 0;
8 |
9 | public Pet() {}
10 | }
11 |
12 | public class Dog : Pet {
13 | public bool IsTrained { get; set; } = false;
14 |
15 | public Dog () {}
16 | }
17 |
18 | public class Cat : Pet {
19 | public bool IsDeclawed { get; set; } = false;
20 |
21 | public Cat () {}
22 | }
23 |
24 | // Define a class that implements an internal collection
25 | public class PetOwner {
26 | public string Name { get; set; } = "";
27 |
28 | public List? Pets { get; set; }
29 | }
30 |
--------------------------------------------------------------------------------
/Finished/Ch2/ObjectInitializers/ObjectInitializers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch2/ObjectInitializers/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using object and collection initializers
3 |
4 | // Use the initializer syntax to create new objects
5 | Dog dog = new Dog {Name = "Fido", Age = 4, IsTrained=true };
6 | Cat cat = new Cat {Name = "Mr. Meowington", Age = 7, IsDeclawed=false};
7 |
8 | Console.WriteLine($"Dog: {dog.Name}, {dog.Age}");
9 | Console.WriteLine($"Cat: {cat.Name}, {cat.Age}");
10 |
11 | // Initializers can be used on anonymous types
12 | var pet = new {Name = "Charlie", Age = 5};
13 | Console.WriteLine($"{pet.Name}, {pet.Age}");
14 |
15 | // Collections can also be initialized this way
16 | int[] numbers = new int[] {1,2,3,4,5,6};
17 | Console.WriteLine($"{numbers.Length}");
18 |
19 | // Initialize a collection with a set of objects
20 | PetOwner owner = new PetOwner {
21 | Name = "Joe Marini",
22 | Pets = new List {
23 | new Dog {Name = "Junebug", Age = 4},
24 | new Cat {Name = "Whiskers", Age = 3},
25 | new Dog {Name = "Max", Age = 10}
26 | }
27 | };
28 |
29 | Console.WriteLine($"{owner.Name}'s Pets:");
30 | foreach (Pet p in owner.Pets) {
31 | Console.WriteLine($"{p.Name}");
32 | }
33 |
--------------------------------------------------------------------------------
/Finished/Ch2/ReadonlyProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using the readonly modifier for class members
3 |
4 | var book1 = new Book("9780393096729", "War and Peace", "Leo Tolstoy");
5 | var book2 = new Book("9780552015004", "Catch-22", "Joseph Heller");
6 |
7 | Console.WriteLine($"{book1}");
8 | Console.WriteLine($"{book2}");
9 |
10 | book1.Update("9780393096729", "War & Peace", "Tolstoy, Leo");
11 | Console.WriteLine($"{book1}");
12 |
--------------------------------------------------------------------------------
/Finished/Ch2/ReadonlyProps/ReadOnly.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using the readonly modifier for class members
3 |
4 | public class Book {
5 | // Declare some private fields
6 | private readonly string _ISBN = "";
7 | private string _title = "";
8 | private string _author = "";
9 |
10 | public Book(string ISBN, string Title, string Author) {
11 | _ISBN = ISBN;
12 | _title = Title;
13 | _author = Author;
14 | }
15 |
16 | public void Update(string ISBN, string Title, string Author) {
17 | // _ISBN = ISBN; // causes a compile error
18 | _title = Title;
19 | _author = Author;
20 | }
21 |
22 | public override string ToString() {
23 | return $"{_ISBN}: {_title} by {_author}";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Finished/Ch2/ReadonlyProps/ReadonlyProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch2/RequiredProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // The "required" modifier
3 |
4 | // Construct some objects using Object Initializer syntax
5 | Employee emp1 = new Employee() {FirstName="John", LastName="Doe", ID=1, Department="Sales"};
6 | Employee emp2 = new Employee() {FirstName="Jane", LastName="Deaux", ID=2, Department="R&D"};
7 | Employee emp3 = new Employee() {FirstName="Jim", LastName="Dough", ID=3, Department="Marketing"};
8 |
9 | // Construct an object using the constructor
10 | Employee emp4 = new Employee("Joe", "Doh", 4, "Marketing");
11 |
12 | Console.WriteLine(emp1);
13 | Console.WriteLine(emp2);
14 | Console.WriteLine(emp3);
15 | Console.WriteLine(emp4);
16 |
--------------------------------------------------------------------------------
/Finished/Ch2/RequiredProps/RequiredExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // The "required" modifier
3 | using System.Diagnostics.CodeAnalysis;
4 |
5 | public class Employee {
6 | public Employee() {}
7 |
8 | // The SetsRequiredMembers attribute indicates that the constructor sets the
9 | // required members, but the compiler doesn't actually check - it trusts you
10 | // Use this attribute with caution
11 | [SetsRequiredMembers]
12 | public Employee(string fname, string lname, int id, string dept) {
13 | ID = id;
14 | FirstName = fname;
15 | LastName = lname;
16 | Department = dept;
17 | }
18 |
19 | // The "required" keyword means that a value must be assigned during construction
20 | // Members that are required must be at least as visible as the containing type
21 | public required int ID {
22 | get;
23 | init;
24 | }
25 | public string? Department {
26 | get; set;
27 | }
28 | public string? FirstName {
29 | get; set;
30 | }
31 | public required string LastName {
32 | get; set;
33 | }
34 |
35 | public override string ToString() => $"{FirstName} {LastName}, ID:{ID} in {Department}";
36 | }
37 |
--------------------------------------------------------------------------------
/Finished/Ch2/RequiredProps/RequiredProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch3/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch3/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public class Employee {
5 | private static int _empCount = 0;
6 | protected static int IDStart;
7 |
8 | static Employee() {
9 | IDStart = 1000;
10 | }
11 |
12 | public Employee() {
13 | Employee._empCount++;
14 | ID = Employee.IDStart++;
15 | }
16 |
17 | public static int EmployeeCount { get => _empCount; }
18 |
19 | public int ID {get; init;}
20 | public required string Department {get; set;}
21 | public required string FullName {get; set;}
22 |
23 | public virtual void AdjustPay(decimal percentage) {}
24 |
25 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
26 | }
27 |
28 | public class HourlyEmployee : Employee {
29 | public HourlyEmployee() {}
30 |
31 | public decimal PayRate {get; set;}
32 |
33 | public override void AdjustPay(decimal percentage)
34 | {
35 | PayRate += (PayRate * percentage);
36 | }
37 | }
38 |
39 | public class SalariedEmployee : Employee {
40 | public SalariedEmployee() {}
41 |
42 | public decimal Salary {get; set;}
43 |
44 | public override void AdjustPay(decimal percentage) {
45 | Salary += (Salary * percentage);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Finished/Ch3/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: add static features to the employee class
3 |
4 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", PayRate=35.0m};
5 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", Salary=75000.0m};
6 |
7 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
8 |
9 | var Emp3 = new SalariedEmployee() {FullName="Jenny Doh", Department="Engineering", Salary=95000.0m};
10 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
11 |
12 | var Emp4 = new HourlyEmployee() {FullName="Jim Dough", Department="Tech Support", PayRate=45.0m};
13 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
14 |
15 | Console.WriteLine($"{Emp1}");
16 | Console.WriteLine($"{Emp2}");
17 | Console.WriteLine($"{Emp3}");
18 | Console.WriteLine($"{Emp4}");
19 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static classes
3 |
4 | // Access the static constant
5 | Console.WriteLine($"There are {Converter.INCH_CM_CONVERT} cm per inch");
6 |
7 | // Use the static class methods
8 | double result = Converter.InToCm(5.0);
9 | Console.WriteLine($"{result}");
10 |
11 | result = Converter.CmToIn(5.0);
12 | Console.WriteLine($"{result}");
13 |
14 | // static classes cannot be instantiated
15 | // Converter conv = new Converter(); // this will cause a compiler error
16 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticClasses/StaticClass.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static classes
3 |
4 |
5 | // Static classes are defined using the 'static' keyword
6 | // They contain only static members (methods, properties, constants)
7 | // They cannot be instantiated, and are sealed by default
8 | // (so they cannot be derived from)
9 | public static class Converter {
10 | public static double INCH_CM_CONVERT = 2.54;
11 |
12 | public static double InToCm(double inches) {
13 | return inches * INCH_CM_CONVERT;
14 | }
15 |
16 | public static double CmToIn(double centimeters) {
17 | return centimeters / INCH_CM_CONVERT;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticClasses/StaticClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticConstructor/MyClass.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static constructors
3 |
4 | // Define a regular class with instance and static methods
5 | public class MyClass {
6 | // static members that only need one-time initialization
7 | public static long CallCounter;
8 | public static string LastCaller;
9 |
10 | // the static constructor is only called once, has no parameters,
11 | // is not called directly, and can not be inherited/overloaded
12 | static MyClass() {
13 | CallCounter = 0;
14 | LastCaller = "Nobody";
15 | Console.WriteLine("Static constructor has been called");
16 | }
17 |
18 | // Regular constructor
19 | public MyClass() {
20 | Console.WriteLine("Regular constructor has been called");
21 | }
22 |
23 | // Instance Method
24 | public void MethodA() {
25 | CallCounter++;
26 | LastCaller = "MethodA";
27 | }
28 |
29 | // Static method
30 | public static void MethodB () {
31 | CallCounter++;
32 | LastCaller = "MethodB";
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticConstructor/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static constructors
3 |
4 | // Instaniate the class
5 | MyClass mc = new MyClass();
6 |
7 | Console.WriteLine($"CallCounter: {MyClass.CallCounter}");
8 | Console.WriteLine($"LastCaller: {MyClass.LastCaller}");
9 |
10 | // Call some methods
11 | mc.MethodA();
12 | MyClass.MethodB();
13 | mc.MethodA();
14 | MyClass.MethodB();
15 |
16 | // Output the number of function calls
17 | Console.WriteLine($"CallCounter: {MyClass.CallCounter}");
18 | Console.WriteLine($"LastCaller: {MyClass.LastCaller}");
19 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticConstructor/StaticConstructor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticMethods/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static methods
3 |
4 | // Declare some temperature values to use
5 | Temperature[] temps = {
6 | new Temperature(19.1), new Temperature(22.5), new Temperature(15.8), new Temperature(20.2),
7 | new Temperature(21.3), new Temperature(18.6), new Temperature(23.0), new Temperature(17.4)
8 | };
9 |
10 | // Static methods are accessed using the class name and the method name
11 | Console.WriteLine($"{Temperature.FtoC(72.0):F2}");
12 | Console.WriteLine($"{Temperature.CtoF(22.0):F2}");
13 |
14 | // How many temperatures are room temp?
15 | var roomtemps = 0;
16 | foreach (Temperature t in temps) {
17 | if (t.IsRoomTemp())
18 | roomtemps++;
19 | }
20 | // Constants are accessed the same as static members
21 | Console.WriteLine($"Room temp is between {Temperature.ROOM_TEMP_LOWER_C}C and {Temperature.ROOM_TEMP_UPPER_C}C");
22 | Console.WriteLine($"{roomtemps} measurements are room temperature");
23 |
24 | // Check to see if a given temperature value is room temp
25 | Console.WriteLine($"{Temperature.IsRoomTemp(22.0)}");
26 | Console.WriteLine($"{Temperature.IsRoomTemp(17.0)}");
27 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticMethods/StaticMethods.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static methods
3 |
4 | public class Temperature {
5 | // constant values don't need to be defined as static, it is implied
6 | public const double ROOM_TEMP_LOWER_C = 20.0;
7 | public const double ROOM_TEMP_UPPER_C = 23.0;
8 |
9 | public Temperature(double t) {
10 | Temp = t;
11 | }
12 |
13 | // static methods use the 'static' modifier in their declaration
14 | public static double FtoC(double FTemp) {
15 | double CTemp = (FTemp - 32) * 5 / 9;
16 |
17 | return CTemp;
18 | }
19 |
20 | public static double CtoF(double CTemp) {
21 | double FTemp = (CTemp * 9 / 5) + 32;
22 |
23 | return FTemp;
24 | }
25 |
26 | // Regular property implementation
27 | public double Temp { get; set; }
28 |
29 | // You can overload methods and have one of them be static. This doesn't work with properties
30 | public bool IsRoomTemp() {
31 | return Temp >= ROOM_TEMP_LOWER_C && Temp <= ROOM_TEMP_UPPER_C;
32 | }
33 |
34 | public static bool IsRoomTemp(double temp) {
35 | return temp >= ROOM_TEMP_LOWER_C && temp <= ROOM_TEMP_UPPER_C;
36 | }
37 |
38 | // This does not work - will cause a compile error
39 | // public bool IsRoomTemp {
40 | // get => Temp >= ROOM_TEMP_LOWER_C && Temp <= ROOM_TEMP_UPPER_C;
41 | // }
42 | }
43 |
--------------------------------------------------------------------------------
/Finished/Ch3/StaticMethods/StaticMethods.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractClasses/AbstractClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining abstract classes
3 |
4 | Car c = new Car() {Make = "Ford", Model = "Escort"};
5 | Motorcycle m = new Motorcycle() {Make = "Triumph", Model = "Thunderbird"};
6 |
7 | Console.WriteLine(c);
8 | c.SoundHorn();
9 | Console.WriteLine(m);
10 | m.SoundHorn();
11 |
12 | // This will cause a compiler error - can't create an abstract class
13 | // Vehicle v = new Vehicle();
14 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractClasses/Vehicles.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining abstract classes
3 |
4 | // Declare an abstract base class to prevent direct instantiation
5 | public abstract class Vehicle
6 | {
7 | public Vehicle() {}
8 |
9 | public required string Model {
10 | get;
11 | init;
12 | }
13 |
14 | public required string Make {
15 | get;
16 | init;
17 | }
18 |
19 | public virtual void SoundHorn() {
20 | Console.WriteLine("Add horn sound here");
21 | }
22 |
23 | public override string ToString() {
24 | return $"{GetType()}: {Make} {Model}";
25 | }
26 | }
27 |
28 | // Declare sublasses that inherit from the abstract class
29 | public class Car : Vehicle
30 | {
31 | public Car() {
32 | }
33 | public override void SoundHorn()
34 | {
35 | Console.WriteLine("Beep Beep");
36 | }
37 | }
38 |
39 | public class Motorcycle : Vehicle
40 | {
41 | public Motorcycle() {
42 | }
43 |
44 | public override void SoundHorn()
45 | {
46 | Console.WriteLine("Honk Honk");
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractPropsFuncs/AbstractPropsFuncs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractPropsFuncs/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | Car c = new Car() {Make = "Ford", Model = "Escort"};
4 | Motorcycle m = new Motorcycle() {Make = "Triumph", Model = "Thunderbird"};
5 |
6 | // Exercise the methods and properties
7 | Console.WriteLine(c);
8 | c.SoundHorn();
9 |
10 | Console.WriteLine(m);
11 | m.SoundHorn();
12 |
--------------------------------------------------------------------------------
/Finished/Ch4/AbstractPropsFuncs/Vehicles.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | // Declare an abstract base class to prevent direct instantiation
4 | public abstract class Vehicle
5 | {
6 | public Vehicle() {
7 | }
8 |
9 | public required string Model {
10 | get;
11 | init;
12 | }
13 |
14 | public required string Make {
15 | get;
16 | init;
17 | }
18 |
19 | // By declaring a member to be abstract, we can require subclasses to implement it
20 | public abstract void SoundHorn();
21 |
22 | public abstract int WheelCount { get; }
23 |
24 | public override string ToString() {
25 | return $"{GetType()}: {Make} {Model}, Wheels: {WheelCount}";
26 | }
27 | }
28 |
29 | // Declare sublasses that inherit from the abstract class
30 | public class Car : Vehicle
31 | {
32 | public Car() {}
33 |
34 | public override int WheelCount => 4;
35 |
36 | public override void SoundHorn()
37 | {
38 | Console.WriteLine("Beep Beep");
39 | }
40 | }
41 |
42 | public class Motorcycle : Vehicle
43 | {
44 | public Motorcycle() {}
45 |
46 | public override int WheelCount => 2;
47 |
48 | public override void SoundHorn()
49 | {
50 | Console.WriteLine("Honk Honk");
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Finished/Ch4/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch4/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public abstract class Employee {
5 | private static int _empCount = 0;
6 | protected static int IDStart;
7 |
8 | static Employee() {
9 | IDStart = 1000;
10 | }
11 |
12 | public Employee() {
13 | Employee._empCount++;
14 | ID = Employee.IDStart++;
15 | }
16 |
17 | public static int EmployeeCount { get => _empCount; }
18 |
19 | public int ID {get; init;}
20 | public required string Department {get; set;}
21 | public required string FullName {get; set;}
22 |
23 | public abstract void AdjustPay(decimal percentage);
24 |
25 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
26 | }
27 |
28 | public sealed class HourlyEmployee : Employee {
29 | public HourlyEmployee() {}
30 |
31 | public decimal PayRate {get; set;}
32 |
33 | public override void AdjustPay(decimal percentage)
34 | {
35 | PayRate += (PayRate * percentage);
36 | }
37 | }
38 |
39 | public sealed class SalariedEmployee : Employee {
40 | public SalariedEmployee() {}
41 |
42 | public decimal Salary {get; set;}
43 |
44 | public override void AdjustPay(decimal percentage) {
45 | Salary += (Salary * percentage);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Finished/Ch4/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: incorporate abstraction into the employee class
3 |
4 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", PayRate=35.0m};
5 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", Salary=75000.0m};
6 |
7 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
8 |
9 | var Emp3 = new SalariedEmployee() {FullName="Jenny Doh", Department="Engineering", Salary=95000.0m};
10 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
11 |
12 | var Emp4 = new HourlyEmployee() {FullName="Jim Dough", Department="Tech Support", PayRate=45.0m};
13 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
14 |
15 | Console.WriteLine($"{Emp1}");
16 | Console.WriteLine($"{Emp2}");
17 | Console.WriteLine($"{Emp3}");
18 | Console.WriteLine($"{Emp4}");
19 |
--------------------------------------------------------------------------------
/Finished/Ch4/SealedClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Sealed classes and members
3 |
4 | // Create a class derived from A
5 | B example1 = new B();
6 | example1.Func1();
7 |
8 | E example2 = new E();
9 | example2.Func2();
10 |
--------------------------------------------------------------------------------
/Finished/Ch4/SealedClasses/SealedClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Finished/Ch4/SealedClasses/SealedExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Sealed classes and members
3 |
4 | // Example 1: Sealing a class
5 | public class A {
6 | public A() {
7 | Console.WriteLine("A");
8 | }
9 |
10 | public virtual void Func1() {
11 | Console.WriteLine($"Func1 in class A");
12 | }
13 | }
14 |
15 | public class B : A {
16 | public B() {
17 | Console.WriteLine("B");
18 | }
19 |
20 | public override sealed void Func1() {
21 | Console.WriteLine("Func1 in class B");
22 | }
23 | }
24 |
25 | // Example 2: Sealing an individual member
26 | public class C {
27 | public C() {}
28 |
29 | public virtual void Func2() {}
30 | }
31 |
32 | public class D : C {
33 | public D() {}
34 |
35 | public override void Func2() {}
36 | }
37 |
38 | public class E : D {
39 | public E() {}
40 |
41 | public override void Func2() {}
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | LinkedIn Learning Exercise Files License Agreement
2 | ==================================================
3 |
4 | This License Agreement (the "Agreement") is a binding legal agreement
5 | between you (as an individual or entity, as applicable) and LinkedIn
6 | Corporation (“LinkedIn”). By downloading or using the LinkedIn Learning
7 | exercise files in this repository (“Licensed Materials”), you agree to
8 | be bound by the terms of this Agreement. If you do not agree to these
9 | terms, do not download or use the Licensed Materials.
10 |
11 | 1. License.
12 | - a. Subject to the terms of this Agreement, LinkedIn hereby grants LinkedIn
13 | members during their LinkedIn Learning subscription a non-exclusive,
14 | non-transferable copyright license, for internal use only, to 1) make a
15 | reasonable number of copies of the Licensed Materials, and 2) make
16 | derivative works of the Licensed Materials for the sole purpose of
17 | practicing skills taught in LinkedIn Learning courses.
18 | - b. Distribution. Unless otherwise noted in the Licensed Materials, subject
19 | to the terms of this Agreement, LinkedIn hereby grants LinkedIn members
20 | with a LinkedIn Learning subscription a non-exclusive, non-transferable
21 | copyright license to distribute the Licensed Materials, except the
22 | Licensed Materials may not be included in any product or service (or
23 | otherwise used) to instruct or educate others.
24 |
25 | 2. Restrictions and Intellectual Property.
26 | - a. You may not to use, modify, copy, make derivative works of, publish,
27 | distribute, rent, lease, sell, sublicense, assign or otherwise transfer the
28 | Licensed Materials, except as expressly set forth above in Section 1.
29 | - b. Linkedin (and its licensors) retains its intellectual property rights
30 | in the Licensed Materials. Except as expressly set forth in Section 1,
31 | LinkedIn grants no licenses.
32 | - c. You indemnify LinkedIn and its licensors and affiliates for i) any
33 | alleged infringement or misappropriation of any intellectual property rights
34 | of any third party based on modifications you make to the Licensed Materials,
35 | ii) any claims arising from your use or distribution of all or part of the
36 | Licensed Materials and iii) a breach of this Agreement. You will defend, hold
37 | harmless, and indemnify LinkedIn and its affiliates (and our and their
38 | respective employees, shareholders, and directors) from any claim or action
39 | brought by a third party, including all damages, liabilities, costs and
40 | expenses, including reasonable attorneys’ fees, to the extent resulting from,
41 | alleged to have resulted from, or in connection with: (a) your breach of your
42 | obligations herein; or (b) your use or distribution of any Licensed Materials.
43 |
44 | 3. Open source. This code may include open source software, which may be
45 | subject to other license terms as provided in the files.
46 |
47 | 4. Warranty Disclaimer. LINKEDIN PROVIDES THE LICENSED MATERIALS ON AN “AS IS”
48 | AND “AS AVAILABLE” BASIS. LINKEDIN MAKES NO REPRESENTATION OR WARRANTY,
49 | WHETHER EXPRESS OR IMPLIED, ABOUT THE LICENSED MATERIALS, INCLUDING ANY
50 | REPRESENTATION THAT THE LICENSED MATERIALS WILL BE FREE OF ERRORS, BUGS OR
51 | INTERRUPTIONS, OR THAT THE LICENSED MATERIALS ARE ACCURATE, COMPLETE OR
52 | OTHERWISE VALID. TO THE FULLEST EXTENT PERMITTED BY LAW, LINKEDIN AND ITS
53 | AFFILIATES DISCLAIM ANY IMPLIED OR STATUTORY WARRANTY OR CONDITION, INCLUDING
54 | ANY IMPLIED WARRANTY OR CONDITION OF MERCHANTABILITY OR FITNESS FOR A
55 | PARTICULAR PURPOSE, AVAILABILITY, SECURITY, TITLE AND/OR NON-INFRINGEMENT.
56 | YOUR USE OF THE LICENSED MATERIALS IS AT YOUR OWN DISCRETION AND RISK, AND
57 | YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE THAT RESULTS FROM USE OF THE
58 | LICENSED MATERIALS TO YOUR COMPUTER SYSTEM OR LOSS OF DATA. NO ADVICE OR
59 | INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM US OR THROUGH OR
60 | FROM THE LICENSED MATERIALS WILL CREATE ANY WARRANTY OR CONDITION NOT
61 | EXPRESSLY STATED IN THESE TERMS.
62 |
63 | 5. Limitation of Liability. LINKEDIN SHALL NOT BE LIABLE FOR ANY INDIRECT,
64 | INCIDENTAL, SPECIAL, PUNITIVE, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING
65 | BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER
66 | INTANGIBLE LOSSES . IN NO EVENT WILL LINKEDIN'S AGGREGATE LIABILITY TO YOU
67 | EXCEED $100. THIS LIMITATION OF LIABILITY SHALL:
68 | - i. APPLY REGARDLESS OF WHETHER (A) YOU BASE YOUR CLAIM ON CONTRACT, TORT,
69 | STATUTE, OR ANY OTHER LEGAL THEORY, (B) WE KNEW OR SHOULD HAVE KNOWN ABOUT
70 | THE POSSIBILITY OF SUCH DAMAGES, OR (C) THE LIMITED REMEDIES PROVIDED IN THIS
71 | SECTION FAIL OF THEIR ESSENTIAL PURPOSE; AND
72 | - ii. NOT APPLY TO ANY DAMAGE THAT LINKEDIN MAY CAUSE YOU INTENTIONALLY OR
73 | KNOWINGLY IN VIOLATION OF THESE TERMS OR APPLICABLE LAW, OR AS OTHERWISE
74 | MANDATED BY APPLICABLE LAW THAT CANNOT BE DISCLAIMED IN THESE TERMS.
75 |
76 | 6. Termination. This Agreement automatically terminates upon your breach of
77 | this Agreement or termination of your LinkedIn Learning subscription. On
78 | termination, all licenses granted under this Agreement will terminate
79 | immediately and you will delete the Licensed Materials. Sections 2-7 of this
80 | Agreement survive any termination of this Agreement. LinkedIn may discontinue
81 | the availability of some or all of the Licensed Materials at any time for any
82 | reason.
83 |
84 | 7. Miscellaneous. This Agreement will be governed by and construed in
85 | accordance with the laws of the State of California without regard to conflict
86 | of laws principles. The exclusive forum for any disputes arising out of or
87 | relating to this Agreement shall be an appropriate federal or state court
88 | sitting in the County of Santa Clara, State of California. If LinkedIn does
89 | not act to enforce a breach of this Agreement, that does not mean that
90 | LinkedIn has waived its right to enforce this Agreement. The Agreement does
91 | not create a partnership, agency relationship, or joint venture between the
92 | parties. Neither party has the power or authority to bind the other or to
93 | create any obligation or responsibility on behalf of the other. You may not,
94 | without LinkedIn’s prior written consent, assign or delegate any rights or
95 | obligations under these terms, including in connection with a change of
96 | control. Any purported assignment and delegation shall be ineffective. The
97 | Agreement shall bind and inure to the benefit of the parties, their respective
98 | successors and permitted assigns. If any provision of the Agreement is
99 | unenforceable, that provision will be modified to render it enforceable to the
100 | extent possible to give effect to the parties’ intentions and the remaining
101 | provisions will not be affected. This Agreement is the only agreement between
102 | you and LinkedIn regarding the Licensed Materials, and supersedes all prior
103 | agreements relating to the Licensed Materials.
104 |
105 | Last Updated: March 2019
106 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright 2023 LinkedIn Corporation
2 | All Rights Reserved.
3 |
4 | Licensed under the LinkedIn Learning Exercise File License (the "License").
5 | See LICENSE in the project root for license information.
6 |
7 | Please note, this project may automatically load third party code from external
8 | repositories (for example, NPM modules, Composer packages, or other dependencies).
9 | If so, such third party code may be subject to other license terms than as set
10 | forth above. In addition, such third party code may also depend on and load
11 | multiple tiers of dependencies. Please review the applicable licenses of the
12 | additional dependencies.
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Advanced C#: Object-Oriented Programming
2 | This is the repository for the LinkedIn Learning course Advanced C#: Object-Oriented Programming. The full course is available from [LinkedIn Learning][lil-course-url].
3 |
4 | ![Advanced C#: Object-Oriented Programming][lil-thumbnail-url]
5 |
6 | Angular helps developers and programmers build and maintain complex applications. The popular, widely used JavaScript platform gives you a solid foundation of web-based functionality, letting you take care of the design and implementation details as you go.
7 |
8 | In this course, instructor Derek Peruo introduces you to the essentials of this incredible platform, including some of its most powerful features such as comprehensive routing and navigation, dependency injection, and much more. Derek steps through Angular one feature at a time, focusing on the component-based architecture of the entire platform. Learn what Angular is, what it can do, how to configure it, how to troubleshoot common problems, and how to get up and running building a full-featured web app, following detailed instructions from start to finish. Upon completing this course, you’ll be ready to tackle other project-based courses in the LinkedIn Learning library and create your own customized Angular application.
9 |
10 | ## Instructions
11 | This repository contains two folders for the contents of the course:
12 | - *Finished*: The fully finished versions of the code examples. Intended to be used as a reference and for help with troubleshooting your own code
13 | - *Start*: The starting point for each exercise. This is the code that you will use in the course to build towards the finished examples.
14 |
15 | ## Installing
16 | 1. To use these exercise files locally on your computer, you must have the following installed:
17 | - .NET SDK, version 7
18 | 2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree.
19 | 3. We suggest using Visual Studio Code as your editor, but any text editor will work
20 |
21 | ## Codespace
22 | This course has been set up to use Codespaces, an online development environment that requires no installation. Fork a copy of the repository in your own Github account and use a Codespace to work entirely online.
23 |
24 | ### Instructor
25 |
26 | Joe Marini
27 |
28 | Senior Technical Lead
29 |
30 | Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/joe-marini).
31 |
32 | [lil-course-url]: https://www.linkedin.com/learning/advanced-c-sharp-object-oriented-programming
33 | [lil-thumbnail-url]: https://media.licdn.com/dms/image/D560DAQFEKONg7FNiDw/learning-public-crop_675_1200/0/1696534679389?e=2147483647&v=beta&t=3gmbZp31_rWONSurpbxaSgCAABJd1QUvGrwfY3eebTA
34 |
35 |
36 |
37 |
38 | [lil-course-url]: https://www.linkedin.com/learning/
39 | [lil-thumbnail-url]: http://
40 |
41 |
--------------------------------------------------------------------------------
/Start/Ch1/AccessModifiers/AccessModifiers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch1/AccessModifiers/Modifiers.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | public class MyClass {
4 | public MyClass() {}
5 |
6 | // public members can be accessed from any other class
7 | public void Func1() {
8 | Console.WriteLine("This is Func1");
9 | SomeValue += 1;
10 | }
11 |
12 | // protected members can be accessed only from this class or derived classes
13 | protected void Func2() {
14 | Console.WriteLine("This is Func2");
15 | SomeValue -= 1;
16 | }
17 |
18 | // private members can only be accessed by this class
19 | private int SomeValue = 1;
20 |
21 | // Prperties often expose internal data, so they are usually public
22 | public int Data {
23 | get => SomeValue;
24 | set => SomeValue = value;
25 | }
26 | }
27 |
28 | public class DerivedClass : MyClass {
29 | public DerivedClass() {}
30 |
31 | public void Func3() {
32 | Console.WriteLine("This is Func3");
33 | // TODO: Func2 can be accessed because this is a subclass of MyClass
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Start/Ch1/AccessModifiers/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Access modifiers
3 |
4 | // create the classes
5 | MyClass class1 = new MyClass();
6 | DerivedClass class2 = new DerivedClass();
7 |
8 | // Access the methods
9 | Console.WriteLine($"Class1 Data value is {class1.Data}");
10 | class1.Func1();
11 | class1.Func1();
12 | Console.WriteLine($"Class1 Data value is {class1.Data}");
13 |
14 | // class2.Func2(); // can't access this function outside the class
15 | Console.WriteLine($"Class2 Data value is {class2.Data}");
16 | class2.Func1();
17 | class2.Func3();
18 | Console.WriteLine($"Class2 Data value is {class2.Data}");
19 |
--------------------------------------------------------------------------------
/Start/Ch1/AnonTypes/AnonTypes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch1/AnonTypes/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Creating and using Anonymous types
3 |
4 | // TODO: Anonymous types can be declared using "new" and { }, similar to JS
5 |
6 |
7 | // Anonymous types are read-only and cannot be modified
8 | // myobj.Name = "Jane Doe"; # will cause an error
9 |
10 | // TODO: To change a value, use non-destructive mutation and "with" clause
11 |
12 |
13 | // TODO: You can check to see if an anonymous object contains a property
14 |
--------------------------------------------------------------------------------
/Start/Ch1/DefineClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining and instantiating classes
3 |
4 | // TODO: Create some new Rectangle objects with dimensions
5 |
6 |
7 | // TODO: Change the values of width and height
8 |
--------------------------------------------------------------------------------
/Start/Ch1/DefineClasses/classes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch1/DefineClasses/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining and instantiating classes
3 |
4 | // TODO: Define a class using the "class" keyword
5 |
6 | // TODO: The constructor accepts parameters used to create the object
7 |
8 |
9 | // TODO: For convenience, we can have a constructor that takes one value
10 | // for squares that have the same side size
11 |
12 |
13 | // TODO: Classes can define methods that return values
14 |
15 |
16 | // TODO: member variables hold data
17 |
--------------------------------------------------------------------------------
/Start/Ch1/Inheritance/Inheritance.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch1/Inheritance/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using inheritance to define a class hierarchy
3 |
4 | // Instantiate some objects
5 | Circle c = new Circle(10);
6 | Rectangle r = new Rectangle(10,20);
7 |
8 | // TODO: Exercise the ToString() method
9 |
10 |
11 | // TODO: Use the "is" operator to test an object type
12 |
13 |
14 | // TODO: Call the GetArea() function on each one
15 |
16 |
17 | // TODO: Print the area of each shape
18 |
19 |
20 | // TODO: All of the classes derive from Shape2D, so we can treat each one
21 | // as an instance of the base class.
22 |
--------------------------------------------------------------------------------
/Start/Ch1/Inheritance/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using inheritance to define a class hierarchy
3 |
4 | // Define a base class that represents the concept of a 2-dimensional shape
5 | class Shape2D {
6 | public Shape2D() {}
7 |
8 | // TODO: Methods must be marked as "virtual" to allow overriding
9 |
10 |
11 | // TODO: All classes in .NET derive from Object, so we get some methods for free
12 | // ToString() returns a string representation of the object
13 | // GetType() returns the type of the object
14 | }
15 |
16 | // Derive a Circle class that inherits from the base Shape2D
17 | class Circle : Shape2D {
18 | public Circle(int r) {
19 | radius = r;
20 | }
21 |
22 | // TODO: Override the GetArea() function for the Circle
23 |
24 | int radius;
25 | }
26 |
27 | // Derive a Rectangle class that inherits from the base Shape2D
28 | class Rectangle : Shape2D {
29 | public Rectangle(int w, int h) {
30 | width = w;
31 | height = h;
32 | }
33 |
34 | // TODO: Override the GetArea() function for the Rectangle
35 |
36 | int width;
37 | int height;
38 | }
39 |
40 | // TODO: Derive a Square class that inherits from the base Rectangle
41 |
--------------------------------------------------------------------------------
/Start/Ch1/PropsMethods/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | // Create some rectangle objects
4 | Rectangle rect1 = new Rectangle(10,20);
5 | Rectangle rect2 = new Rectangle(30);
6 |
7 | Console.WriteLine(rect1.GetArea());
8 | Console.WriteLine(rect2.GetArea());
9 |
10 | // TODO: Operate on the Properties
11 |
12 |
13 | // TODO: Try setting an invalid value
14 |
--------------------------------------------------------------------------------
/Start/Ch1/PropsMethods/PropsMethods.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch1/PropsMethods/shapes.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Working with properties and methods
3 |
4 | // Define a class using the "class" keyword
5 | class Rectangle {
6 | // The constructor accepts parameters used to create the object
7 | public Rectangle(int w, int h) {
8 | width = w;
9 | height = h;
10 | }
11 |
12 | // For convenience, we can have a constructor that takes one value
13 | // for squares that have the same side size
14 | public Rectangle(int side) {
15 | width = height = side;
16 | }
17 |
18 | // Classes can define methods that return values
19 | public int GetArea() {
20 | return width * height;
21 | }
22 |
23 | // TODO: Define Properties that allow access to the private data
24 | // These are called "backing field" properties
25 |
26 |
27 | // TODO: Auto-implmeneted properties don't have a backing field
28 |
29 |
30 | // Properties and member variables hold data
31 | int width;
32 | int height;
33 | }
34 |
--------------------------------------------------------------------------------
/Start/Ch2/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch2/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public class Employee {
5 | public Employee() {}
6 |
7 | // YOUR CODE GOES HERE
8 |
9 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
10 | }
11 |
12 | // DEFINE OTHER CLASSES HERE
13 |
--------------------------------------------------------------------------------
/Start/Ch2/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: create a class hierarchy to represent employees
3 |
4 | // Test code for the programming challenge
5 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", ID=1, PayRate=35.0m};
6 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", ID=2, Salary=75000.0m};
7 |
8 | Console.WriteLine($"{Emp1} -- {Emp1.PayRate:C2}");
9 | Emp1.Department = "Legal";
10 | Emp1.AdjustPay(0.10m);
11 | Console.WriteLine($"{Emp1} -- {Emp1.PayRate:C2}");
12 |
13 | Console.WriteLine("-------------------");
14 |
15 | Console.WriteLine($"{Emp2} -- {Emp2.Salary:C2}");
16 | Emp2.Department = "Solution Architecture";
17 | Emp2.AdjustPay(0.07m);
18 | Console.WriteLine($"{Emp2} -- {Emp2.Salary:C2}");
19 |
--------------------------------------------------------------------------------
/Start/Ch2/InitProps/InitExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // init-only modifier
3 |
4 | public class Employee {
5 | private int _id;
6 |
7 | public Employee() {}
8 |
9 | public Employee(string fname, string lname, int id, string dept) {
10 | FirstName = fname;
11 | LastName = lname;
12 | ID = id;
13 | Department = dept;
14 | }
15 |
16 | // The init keyword means that a value is assigned only during construction
17 | public int ID {
18 | get => _id;
19 | set => _id = value;
20 | }
21 | public string? Department {
22 | get; set;
23 | }
24 | public string? FirstName {
25 | get; set;
26 | }
27 | public string? LastName {
28 | get; set;
29 | }
30 |
31 | public override string ToString() => $"{FirstName} {LastName}, ID:{ID} in {Department}";
32 | }
33 |
--------------------------------------------------------------------------------
/Start/Ch2/InitProps/InitProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch2/InitProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // init-only modifier
3 |
4 | // create two objects using Initializers and a Constructor
5 | Employee emp1 = new Employee() {FirstName="John", LastName="Doe", ID=1, Department="Sales"};
6 | Employee emp2 = new Employee("Jane", "Deaux", 2, "Sales");
7 |
8 |
9 | Console.WriteLine(emp1);
10 | emp1.Department = "Tech Support";
11 | emp1.ID = 5;
12 | Console.WriteLine(emp1);
13 |
14 | Console.WriteLine(emp2);
15 | emp2.LastName = "Dough";
16 | emp2.ID = 3;
17 | Console.WriteLine(emp2);
18 |
--------------------------------------------------------------------------------
/Start/Ch2/ObjectInitializers/Initializers.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using object initializers
3 |
4 | // Example: class that defines a Pet with a name and age
5 | public class Pet {
6 | public string Name { get; set; } = "";
7 | public int Age { get; set; } = 0;
8 |
9 | public Pet() {}
10 | }
11 |
12 | public class Dog : Pet {
13 | public bool IsTrained { get; set; } = false;
14 |
15 | public Dog () {}
16 | }
17 |
18 | public class Cat : Pet {
19 | public bool IsDeclawed { get; set; } = false;
20 |
21 | public Cat () {}
22 | }
23 |
24 | // Define a class that implements an internal collection
25 | public class PetOwner {
26 | public string Name { get; set; } = "";
27 |
28 | public List? Pets { get; set; }
29 | }
30 |
--------------------------------------------------------------------------------
/Start/Ch2/ObjectInitializers/ObjectInitializers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch2/ObjectInitializers/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using object and collection initializers
3 |
4 | // TODO: Use the initializer syntax to create new objects
5 |
6 |
7 | // TODO: Initializers can be used on anonymous types
8 |
9 |
10 | // TODO: Collections can also be initialized this way
11 |
12 |
13 | // TODO: Initialize a collection with a set of objects
14 |
15 |
--------------------------------------------------------------------------------
/Start/Ch2/ReadonlyProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using the readonly modifier for class members
3 |
4 | var book1 = new Book("9780393096729", "War and Peace", "Leo Tolstoy");
5 | var book2 = new Book("9780552015004", "Catch-22", "Joseph Heller");
6 |
7 | Console.WriteLine($"{book1}");
8 | Console.WriteLine($"{book2}");
9 |
10 | book1.Update("9780393096729", "War & Peace", "Tolstoy, Leo");
11 | Console.WriteLine($"{book1}");
12 |
--------------------------------------------------------------------------------
/Start/Ch2/ReadonlyProps/ReadOnly.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using the readonly modifier for class members
3 |
4 | public class Book {
5 | // Declare some private fields
6 | private string _ISBN = "";
7 | private string _title = "";
8 | private string _author = "";
9 |
10 | public Book(string ISBN, string Title, string Author) {
11 | _ISBN = ISBN;
12 | _title = Title;
13 | _author = Author;
14 | }
15 |
16 | public void Update(string ISBN, string Title, string Author) {
17 | _ISBN = ISBN;
18 | _title = Title;
19 | _author = Author;
20 | }
21 |
22 | public override string ToString() {
23 | return $"{_ISBN}: {_title} by {_author}";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Start/Ch2/ReadonlyProps/ReadonlyProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch2/RequiredProps/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // The "required" modifier
3 |
4 | // Construct some objects using Object Initializer syntax
5 | Employee emp1 = new Employee() {FirstName="John", LastName="Doe", ID=1, Department="Sales"};
6 | Employee emp2 = new Employee() {FirstName="Jane", LastName="Deaux", ID=2, Department="R&D"};
7 | Employee emp3 = new Employee() {FirstName="Jim", LastName="Dough", ID=3, Department="Marketing"};
8 |
9 | // TODO: Construct an object using the constructor
10 |
11 |
12 | Console.WriteLine(emp1);
13 | Console.WriteLine(emp2);
14 | Console.WriteLine(emp3);
15 |
--------------------------------------------------------------------------------
/Start/Ch2/RequiredProps/RequiredExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // The "required" modifier
3 |
4 | public class Employee {
5 | public Employee() {}
6 |
7 | // TODO: The SetsRequiredMembers attribute indicates that the constructor sets the
8 | // required members, but the compiler doesn't actually check - it trusts you
9 | // Use this attribute with caution
10 | // public Employee(string fname, string lname, int id, string dept) {
11 | // ID = id;
12 | // FirstName = fname;
13 | // LastName = lname;
14 | // Department = dept;
15 | // }
16 |
17 | // TODO: The "required" keyword means that a value must be assigned during construction
18 | // Members that are required must be at least as visible as the containing type
19 | public int ID {
20 | get;
21 | init;
22 | }
23 | public string? Department {
24 | get; set;
25 | }
26 | public string? FirstName {
27 | get; set;
28 | }
29 | public string LastName {
30 | get; set;
31 | }
32 |
33 | public override string ToString() => $"{FirstName} {LastName}, ID:{ID} in {Department}";
34 | }
35 |
--------------------------------------------------------------------------------
/Start/Ch2/RequiredProps/RequiredProps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch3/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch3/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public class Employee {
5 | public Employee() {}
6 |
7 | public required int ID {get; init;}
8 | public required string Department {get; set;}
9 | public required string FullName {get; set;}
10 |
11 | public virtual void AdjustPay(decimal percentage) {}
12 |
13 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
14 | }
15 |
16 | public class HourlyEmployee : Employee {
17 | public HourlyEmployee() {}
18 |
19 | public decimal PayRate {get; set;}
20 |
21 | public override void AdjustPay(decimal percentage)
22 | {
23 | PayRate += (PayRate * percentage);
24 | }
25 | }
26 |
27 | public class SalariedEmployee : Employee {
28 | public SalariedEmployee() {}
29 |
30 | public decimal Salary {get; set;}
31 |
32 | public override void AdjustPay(decimal percentage) {
33 | Salary += (Salary * percentage);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Start/Ch3/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: create a class hierarchy to represent employees
3 |
4 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", PayRate=35.0m};
5 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", Salary=75000.0m};
6 |
7 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
8 |
9 | var Emp3 = new SalariedEmployee() {FullName="Jenny Doh", Department="Engineering", Salary=95000.0m};
10 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
11 |
12 | var Emp4 = new HourlyEmployee() {FullName="Jim Dough", Department="Tech Support", PayRate=45.0m};
13 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
14 |
15 | Console.WriteLine($"{Emp1}");
16 | Console.WriteLine($"{Emp2}");
17 | Console.WriteLine($"{Emp3}");
18 | Console.WriteLine($"{Emp4}");
19 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static classes
3 |
4 | // Access the static constant
5 | Console.WriteLine($"There are {Converter.INCH_CM_CONVERT} cm per inch");
6 |
7 | // Use the static class methods
8 | double result = Converter.InToCm(5.0);
9 | Console.WriteLine($"{result}");
10 |
11 | result = Converter.CmToIn(5.0);
12 | Console.WriteLine($"{result}");
13 |
14 | // static classes cannot be instantiated
15 | // Converter conv = new Converter(); // this will cause a compiler error
16 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticClasses/StaticClass.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static classes
3 |
4 |
5 | // Static classes are defined using the 'static' keyword
6 | // They contain only static members (methods, properties, constants)
7 | // They cannot be instantiated, and are sealed by default
8 | // (so they cannot be derived from)
9 | public class Converter {
10 | public static double INCH_CM_CONVERT = 2.54;
11 |
12 | public static double InToCm(double inches) {
13 | return inches * INCH_CM_CONVERT;
14 | }
15 |
16 | public static double CmToIn(double centimeters) {
17 | return centimeters / INCH_CM_CONVERT;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticClasses/StaticClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticConstructor/MyClass.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static constructors
3 |
4 | // Define a regular class with instance and static methods
5 | public class MyClass {
6 | // static members that only need one-time initialization
7 | public static long CallCounter;
8 | public static string LastCaller;
9 |
10 | // TODO: the static constructor is only called once, has no parameters,
11 | // is not called directly, and can not be inherited/overloaded
12 |
13 |
14 | // Regular constructor
15 | public MyClass() {
16 | Console.WriteLine("Regular constructor has been called");
17 | }
18 |
19 | // Instance Method
20 | public void MethodA() {
21 | CallCounter++;
22 | LastCaller = "MethodA";
23 | }
24 |
25 | // Static method
26 | public static void MethodB () {
27 | CallCounter++;
28 | LastCaller = "MethodB";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticConstructor/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static constructors
3 |
4 | // Instaniate the class
5 | MyClass mc = new MyClass();
6 |
7 | Console.WriteLine($"CallCounter: {MyClass.CallCounter}");
8 | Console.WriteLine($"LastCaller: {MyClass.LastCaller}");
9 |
10 | // Call some methods
11 | mc.MethodA();
12 | MyClass.MethodB();
13 | mc.MethodA();
14 | MyClass.MethodB();
15 |
16 | // Output the number of function calls
17 | Console.WriteLine($"CallCounter: {MyClass.CallCounter}");
18 | Console.WriteLine($"LastCaller: {MyClass.LastCaller}");
19 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticConstructor/StaticConstructor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticMethods/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static methods
3 |
4 | // Declare some temperature values to use
5 | Temperature[] temps = {
6 | new Temperature(19.1), new Temperature(22.5), new Temperature(15.8), new Temperature(20.2),
7 | new Temperature(21.3), new Temperature(18.6), new Temperature(23.0), new Temperature(17.4)
8 | };
9 |
10 | // TODO: Static methods are accessed using the class name and the method name
11 |
12 |
13 | // How many temperatures are room temp?
14 | // var roomtemps = 0;
15 | // foreach (Temperature t in temps) {
16 | // if (t.IsRoomTemp())
17 | // roomtemps++;
18 | // }
19 | // Constants are accessed the same as static members
20 | // Console.WriteLine($"Room temp is between {Temperature.ROOM_TEMP_LOWER_C}C and {Temperature.ROOM_TEMP_UPPER_C}C");
21 | // Console.WriteLine($"{roomtemps} measurements are room temperature");
22 |
23 | // TODO: Check to see if a given temperature value is room temp
24 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticMethods/StaticMethods.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Using static methods
3 |
4 | public class Temperature {
5 | // constant values don't need to be defined as static, it is implied
6 | public const double ROOM_TEMP_LOWER_C = 20.0;
7 | public const double ROOM_TEMP_UPPER_C = 23.0;
8 |
9 | public Temperature(double t) {
10 | Temp = t;
11 | }
12 |
13 | // TODO: static methods use the 'static' modifier in their declaration
14 |
15 | // Regular property implementation
16 | public double Temp { get; set; }
17 |
18 | // TODO: You can overload methods and have one of them be static. This doesn't work with properties
19 | public bool IsRoomTemp() {
20 | return Temp >= ROOM_TEMP_LOWER_C && Temp <= ROOM_TEMP_UPPER_C;
21 | }
22 |
23 | // This does not work - will cause a compile error
24 | // public bool IsRoomTemp {
25 | // get => Temp >= ROOM_TEMP_LOWER_C && Temp <= ROOM_TEMP_UPPER_C;
26 | // }
27 | }
28 |
--------------------------------------------------------------------------------
/Start/Ch3/StaticMethods/StaticMethods.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractClasses/AbstractClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining abstract classes
3 |
4 | Car c = new Car() {Make = "Ford", Model = "Escort"};
5 | Motorcycle m = new Motorcycle() {Make = "Triumph", Model = "Thunderbird"};
6 |
7 | Console.WriteLine(c);
8 | c.SoundHorn();
9 | Console.WriteLine(m);
10 | m.SoundHorn();
11 |
12 | // TODO: Instantiate the base class
13 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractClasses/Vehicles.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Defining abstract classes
3 |
4 | // Declare an abstract base class to prevent direct instantiation
5 | public class Vehicle
6 | {
7 | public Vehicle() {}
8 |
9 | public string? Model {
10 | get;
11 | init;
12 | }
13 |
14 | public string? Make {
15 | get;
16 | init;
17 | }
18 |
19 | public virtual void SoundHorn() {
20 | Console.WriteLine("Add horn sound here");
21 | }
22 |
23 | public override string ToString() {
24 | return $"{GetType()}: {Make} {Model}";
25 | }
26 | }
27 |
28 | // Declare sublasses that inherit from the abstract class
29 | public class Car : Vehicle
30 | {
31 | public Car() {
32 | }
33 | public override void SoundHorn()
34 | {
35 | Console.WriteLine("Beep Beep");
36 | }
37 | }
38 |
39 | public class Motorcycle : Vehicle
40 | {
41 | public Motorcycle() {
42 | }
43 |
44 | public override void SoundHorn()
45 | {
46 | Console.WriteLine("Honk Honk");
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractPropsFuncs/AbstractPropsFuncs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractPropsFuncs/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | Car c = new Car() {Make = "Ford", Model = "Escort"};
4 | Motorcycle m = new Motorcycle() {Make = "Triumph", Model = "Thunderbird"};
5 |
6 | // Exercise the methods and properties
7 | Console.WriteLine(c);
8 | c.SoundHorn();
9 |
10 | Console.WriteLine(m);
11 | m.SoundHorn();
12 |
--------------------------------------------------------------------------------
/Start/Ch4/AbstractPropsFuncs/Vehicles.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 |
3 | // Declare an abstract base class to prevent direct instantiation
4 | public abstract class Vehicle
5 | {
6 | public Vehicle() {
7 | }
8 |
9 | public required string Model {
10 | get;
11 | init;
12 | }
13 |
14 | public required string Make {
15 | get;
16 | init;
17 | }
18 |
19 | // By declaring a member to be abstract, we can require subclasses to implement it
20 | public virtual void SoundHorn() {
21 | Console.WriteLine("Add horn sound here");
22 | }
23 |
24 | public virtual int WheelCount { get; }
25 |
26 | public override string ToString() {
27 | return $"{GetType()}: {Make} {Model}, Wheels: {WheelCount}";
28 | }
29 | }
30 |
31 | // Declare sublasses that inherit from the abstract class
32 | public class Car : Vehicle
33 | {
34 | public Car() {}
35 | }
36 |
37 | public class Motorcycle : Vehicle
38 | {
39 | public Motorcycle() {}
40 | }
41 |
--------------------------------------------------------------------------------
/Start/Ch4/Challenge/Challenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch4/Challenge/Employees.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Solution to the Employee Class challenge
3 |
4 | public class Employee {
5 | private static int _empCount = 0;
6 | protected static int IDStart;
7 |
8 | static Employee() {
9 | IDStart = 1000;
10 | }
11 |
12 | public Employee() {
13 | Employee._empCount++;
14 | ID = Employee.IDStart++;
15 | }
16 |
17 | public static int EmployeeCount { get => _empCount; }
18 |
19 | public int ID {get; init;}
20 | public required string Department {get; set;}
21 | public required string FullName {get; set;}
22 |
23 | public virtual void AdjustPay(decimal percentage) {}
24 |
25 | public override string ToString() => $"{ID}:{FullName}, {Department} ";
26 | }
27 |
28 | public class HourlyEmployee : Employee {
29 | public HourlyEmployee() {}
30 |
31 | public decimal PayRate {get; set;}
32 |
33 | public override void AdjustPay(decimal percentage)
34 | {
35 | PayRate += (PayRate * percentage);
36 | }
37 | }
38 |
39 | public class SalariedEmployee : Employee {
40 | public SalariedEmployee() {}
41 |
42 | public decimal Salary {get; set;}
43 |
44 | public override void AdjustPay(decimal percentage) {
45 | Salary += (Salary * percentage);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Start/Ch4/Challenge/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Challenge: add static features to the employee class
3 |
4 | var Emp1 = new HourlyEmployee() {FullName="John Doe", Department="Sales", PayRate=35.0m};
5 | var Emp2 = new SalariedEmployee() {FullName="Jane Deaux", Department="Marketing", Salary=75000.0m};
6 |
7 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
8 |
9 | var Emp3 = new SalariedEmployee() {FullName="Jenny Doh", Department="Engineering", Salary=95000.0m};
10 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
11 |
12 | var Emp4 = new HourlyEmployee() {FullName="Jim Dough", Department="Tech Support", PayRate=45.0m};
13 | Console.WriteLine($"Count: {Employee.EmployeeCount}");
14 |
15 | Console.WriteLine($"{Emp1}");
16 | Console.WriteLine($"{Emp2}");
17 | Console.WriteLine($"{Emp3}");
18 | Console.WriteLine($"{Emp4}");
19 |
--------------------------------------------------------------------------------
/Start/Ch4/SealedClasses/Program.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Sealed classes and members
3 |
4 | // TODO: Seal a class
5 | B example1 = new B();
6 | example1.Func1();
7 |
8 | // TODO: Seal a method
9 |
--------------------------------------------------------------------------------
/Start/Ch4/SealedClasses/SealedClasses.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Start/Ch4/SealedClasses/SealedExample.cs:
--------------------------------------------------------------------------------
1 | // Example file for Advanced C#: Object Oriented Programming by Joe Marini
2 | // Sealed classes and members
3 |
4 | // Example 1: Sealing a class
5 | public class A {
6 | public A() {
7 | Console.WriteLine("A");
8 | }
9 |
10 | public virtual void Func1() {
11 | Console.WriteLine($"Func1 in class A");
12 | }
13 | }
14 |
15 | public class B : A {
16 | public B() {
17 | Console.WriteLine("B");
18 | }
19 |
20 | public override void Func1() {
21 | Console.WriteLine("Func1 in class B");
22 | }
23 | }
24 |
25 | // Example 2: Sealing an individual member
26 | public class C {
27 | public C() {}
28 |
29 | public virtual void Func2() {}
30 | }
31 |
32 | public class D : C {
33 | public D() {}
34 |
35 | public override void Func2() {}
36 | }
37 |
38 | public class E : D {
39 | public E() {}
40 |
41 | public override void Func2() {}
42 | }
43 |
--------------------------------------------------------------------------------
/c-sharp-advanced-object-oriented-programming-4406346.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.002.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Finished", "Finished", "{3F96C913-2334-4A9D-AB71-999C561D851C}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch1", "Ch1", "{D8816D66-415A-4306-A81E-F23961EB9A19}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PropsMethods", "Finished\Ch1\PropsMethods\PropsMethods.csproj", "{865BA8E9-B068-4F6E-885B-8064F4FA4284}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccessModifiers", "Finished\Ch1\AccessModifiers\AccessModifiers.csproj", "{28E2920C-1E0A-4413-8BB7-C1CD025E5412}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "classes", "Finished\Ch1\DefineClasses\classes.csproj", "{32EDD1F6-BE5B-465C-9BAF-1A550F4E0971}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inheritance", "Finished\Ch1\Inheritance\Inheritance.csproj", "{3882E3BC-8131-408D-ADCA-3F00A3075A52}"
17 | EndProject
18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnonTypes", "Finished\Ch1\AnonTypes\AnonTypes.csproj", "{4CA9F4C3-DA08-43B5-96A0-D30D86BB956C}"
19 | EndProject
20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch3", "Ch3", "{68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF}"
21 | EndProject
22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticMethods", "Finished\Ch3\StaticMethods\StaticMethods.csproj", "{4C1D8072-3C00-4929-AB0C-AF608E3D6CCB}"
23 | EndProject
24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticConstructor", "Finished\Ch3\StaticConstructor\StaticConstructor.csproj", "{2365ADE6-11BC-41B5-812A-72B988882DD7}"
25 | EndProject
26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticClasses", "Finished\Ch3\StaticClasses\StaticClasses.csproj", "{E445A9DE-9B0D-4EF7-AD70-C6F80BED1758}"
27 | EndProject
28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Challenge", "Finished\Ch3\Challenge\Challenge.csproj", "{89990351-7A92-4E64-9362-5A6362FBF5A4}"
29 | EndProject
30 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch4", "Ch4", "{1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1}"
31 | EndProject
32 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractPropsFuncs", "Finished\Ch4\AbstractPropsFuncs\AbstractPropsFuncs.csproj", "{C03ADAFA-D08D-483E-80AF-686C88934A5C}"
33 | EndProject
34 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SealedClasses", "Finished\Ch4\SealedClasses\SealedClasses.csproj", "{FF765491-EB76-4880-BEC8-0BE77403E2D1}"
35 | EndProject
36 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Challenge", "Finished\Ch4\Challenge\Challenge.csproj", "{AFF0D5CC-12B7-4275-87FD-FDE36515AC07}"
37 | EndProject
38 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractClasses", "Finished\Ch4\AbstractClasses\AbstractClasses.csproj", "{15A9DB71-56F5-4BFA-83E9-738809E2EE1C}"
39 | EndProject
40 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch2", "Ch2", "{E824A57C-4950-43A7-BFCD-4D5DA7A84779}"
41 | EndProject
42 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitProps", "Finished\Ch2\InitProps\InitProps.csproj", "{8E1DDBD7-B306-4130-9EF7-EB5081726778}"
43 | EndProject
44 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RequiredProps", "Finished\Ch2\RequiredProps\RequiredProps.csproj", "{1EE5BF87-BEE2-42FD-A196-765CF05D2E13}"
45 | EndProject
46 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadonlyProps", "Finished\Ch2\ReadonlyProps\ReadonlyProps.csproj", "{A0651637-7897-46B9-8646-D6F8CB428912}"
47 | EndProject
48 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Challenge", "Finished\Ch2\Challenge\Challenge.csproj", "{3C590765-B5FD-4969-BE06-D829D2E06A12}"
49 | EndProject
50 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObjectInitializers", "Finished\Ch2\ObjectInitializers\ObjectInitializers.csproj", "{FDCE7091-7047-4084-B8CC-948A75ABDDDF}"
51 | EndProject
52 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Start", "Start", "{28B0273A-72D2-4D0A-BC51-8B8A81BDAEC2}"
53 | EndProject
54 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch1", "Ch1", "{57932C51-07BF-4FC7-BA4D-31CB1B98172B}"
55 | EndProject
56 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PropsMethods", "Start\Ch1\PropsMethods\PropsMethods.csproj", "{A503BFB9-F911-41A2-A4DA-ADB4069A39E2}"
57 | EndProject
58 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccessModifiers", "Start\Ch1\AccessModifiers\AccessModifiers.csproj", "{EF0822F7-1C29-4845-A180-D68F52E4AA14}"
59 | EndProject
60 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "classes", "Start\Ch1\DefineClasses\classes.csproj", "{0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6}"
61 | EndProject
62 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Inheritance", "Start\Ch1\Inheritance\Inheritance.csproj", "{2BFB8143-C7BE-4E55-B652-05E5CDD06115}"
63 | EndProject
64 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnonTypes", "Start\Ch1\AnonTypes\AnonTypes.csproj", "{5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2}"
65 | EndProject
66 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch3", "Ch3", "{2065B529-ECBF-4C13-BDED-E8C3E69187BA}"
67 | EndProject
68 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticMethods", "Start\Ch3\StaticMethods\StaticMethods.csproj", "{24807BD9-4DBE-4CEB-956F-811053D27A0F}"
69 | EndProject
70 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticConstructor", "Start\Ch3\StaticConstructor\StaticConstructor.csproj", "{71FF58AC-E6E4-43C0-9B61-21CBECB0295F}"
71 | EndProject
72 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticClasses", "Start\Ch3\StaticClasses\StaticClasses.csproj", "{C684B99B-0453-45A3-A26A-93E0F393935D}"
73 | EndProject
74 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch4", "Ch4", "{9BEE2F4C-2B67-4938-AA7C-C09574A0A8BF}"
75 | EndProject
76 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractPropsFuncs", "Start\Ch4\AbstractPropsFuncs\AbstractPropsFuncs.csproj", "{2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675}"
77 | EndProject
78 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SealedClasses", "Start\Ch4\SealedClasses\SealedClasses.csproj", "{63BE429B-AA85-4ADE-A980-5665F06D8FDC}"
79 | EndProject
80 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractClasses", "Start\Ch4\AbstractClasses\AbstractClasses.csproj", "{B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E}"
81 | EndProject
82 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ch2", "Ch2", "{1867716F-7531-4CB2-8098-1F46F365E5AB}"
83 | EndProject
84 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitProps", "Start\Ch2\InitProps\InitProps.csproj", "{06E11B85-2BDB-49A2-9BED-90633F6F5C92}"
85 | EndProject
86 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RequiredProps", "Start\Ch2\RequiredProps\RequiredProps.csproj", "{229505C3-A4BF-4F8A-BC05-EB15E7A85996}"
87 | EndProject
88 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadonlyProps", "Start\Ch2\ReadonlyProps\ReadonlyProps.csproj", "{5B646387-A7B1-43B3-A8C5-93A1BB5B1E64}"
89 | EndProject
90 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Challenge", "Start\Ch2\Challenge\Challenge.csproj", "{59504D1A-283B-4B08-B13C-FE8E8F10F3D4}"
91 | EndProject
92 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObjectInitializers", "Start\Ch2\ObjectInitializers\ObjectInitializers.csproj", "{6C2D7E56-1653-454E-A9B9-F5CFA850B9B1}"
93 | EndProject
94 | Global
95 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
96 | Debug|Any CPU = Debug|Any CPU
97 | Release|Any CPU = Release|Any CPU
98 | EndGlobalSection
99 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
100 | {865BA8E9-B068-4F6E-885B-8064F4FA4284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
101 | {865BA8E9-B068-4F6E-885B-8064F4FA4284}.Debug|Any CPU.Build.0 = Debug|Any CPU
102 | {865BA8E9-B068-4F6E-885B-8064F4FA4284}.Release|Any CPU.ActiveCfg = Release|Any CPU
103 | {865BA8E9-B068-4F6E-885B-8064F4FA4284}.Release|Any CPU.Build.0 = Release|Any CPU
104 | {28E2920C-1E0A-4413-8BB7-C1CD025E5412}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
105 | {28E2920C-1E0A-4413-8BB7-C1CD025E5412}.Debug|Any CPU.Build.0 = Debug|Any CPU
106 | {28E2920C-1E0A-4413-8BB7-C1CD025E5412}.Release|Any CPU.ActiveCfg = Release|Any CPU
107 | {28E2920C-1E0A-4413-8BB7-C1CD025E5412}.Release|Any CPU.Build.0 = Release|Any CPU
108 | {32EDD1F6-BE5B-465C-9BAF-1A550F4E0971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
109 | {32EDD1F6-BE5B-465C-9BAF-1A550F4E0971}.Debug|Any CPU.Build.0 = Debug|Any CPU
110 | {32EDD1F6-BE5B-465C-9BAF-1A550F4E0971}.Release|Any CPU.ActiveCfg = Release|Any CPU
111 | {32EDD1F6-BE5B-465C-9BAF-1A550F4E0971}.Release|Any CPU.Build.0 = Release|Any CPU
112 | {3882E3BC-8131-408D-ADCA-3F00A3075A52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
113 | {3882E3BC-8131-408D-ADCA-3F00A3075A52}.Debug|Any CPU.Build.0 = Debug|Any CPU
114 | {3882E3BC-8131-408D-ADCA-3F00A3075A52}.Release|Any CPU.ActiveCfg = Release|Any CPU
115 | {3882E3BC-8131-408D-ADCA-3F00A3075A52}.Release|Any CPU.Build.0 = Release|Any CPU
116 | {4CA9F4C3-DA08-43B5-96A0-D30D86BB956C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
117 | {4CA9F4C3-DA08-43B5-96A0-D30D86BB956C}.Debug|Any CPU.Build.0 = Debug|Any CPU
118 | {4CA9F4C3-DA08-43B5-96A0-D30D86BB956C}.Release|Any CPU.ActiveCfg = Release|Any CPU
119 | {4CA9F4C3-DA08-43B5-96A0-D30D86BB956C}.Release|Any CPU.Build.0 = Release|Any CPU
120 | {4C1D8072-3C00-4929-AB0C-AF608E3D6CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
121 | {4C1D8072-3C00-4929-AB0C-AF608E3D6CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
122 | {4C1D8072-3C00-4929-AB0C-AF608E3D6CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
123 | {4C1D8072-3C00-4929-AB0C-AF608E3D6CCB}.Release|Any CPU.Build.0 = Release|Any CPU
124 | {2365ADE6-11BC-41B5-812A-72B988882DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
125 | {2365ADE6-11BC-41B5-812A-72B988882DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
126 | {2365ADE6-11BC-41B5-812A-72B988882DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
127 | {2365ADE6-11BC-41B5-812A-72B988882DD7}.Release|Any CPU.Build.0 = Release|Any CPU
128 | {E445A9DE-9B0D-4EF7-AD70-C6F80BED1758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
129 | {E445A9DE-9B0D-4EF7-AD70-C6F80BED1758}.Debug|Any CPU.Build.0 = Debug|Any CPU
130 | {E445A9DE-9B0D-4EF7-AD70-C6F80BED1758}.Release|Any CPU.ActiveCfg = Release|Any CPU
131 | {E445A9DE-9B0D-4EF7-AD70-C6F80BED1758}.Release|Any CPU.Build.0 = Release|Any CPU
132 | {89990351-7A92-4E64-9362-5A6362FBF5A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
133 | {89990351-7A92-4E64-9362-5A6362FBF5A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
134 | {89990351-7A92-4E64-9362-5A6362FBF5A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
135 | {89990351-7A92-4E64-9362-5A6362FBF5A4}.Release|Any CPU.Build.0 = Release|Any CPU
136 | {C03ADAFA-D08D-483E-80AF-686C88934A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
137 | {C03ADAFA-D08D-483E-80AF-686C88934A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
138 | {C03ADAFA-D08D-483E-80AF-686C88934A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
139 | {C03ADAFA-D08D-483E-80AF-686C88934A5C}.Release|Any CPU.Build.0 = Release|Any CPU
140 | {FF765491-EB76-4880-BEC8-0BE77403E2D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
141 | {FF765491-EB76-4880-BEC8-0BE77403E2D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
142 | {FF765491-EB76-4880-BEC8-0BE77403E2D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
143 | {FF765491-EB76-4880-BEC8-0BE77403E2D1}.Release|Any CPU.Build.0 = Release|Any CPU
144 | {AFF0D5CC-12B7-4275-87FD-FDE36515AC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
145 | {AFF0D5CC-12B7-4275-87FD-FDE36515AC07}.Debug|Any CPU.Build.0 = Debug|Any CPU
146 | {AFF0D5CC-12B7-4275-87FD-FDE36515AC07}.Release|Any CPU.ActiveCfg = Release|Any CPU
147 | {AFF0D5CC-12B7-4275-87FD-FDE36515AC07}.Release|Any CPU.Build.0 = Release|Any CPU
148 | {15A9DB71-56F5-4BFA-83E9-738809E2EE1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
149 | {15A9DB71-56F5-4BFA-83E9-738809E2EE1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
150 | {15A9DB71-56F5-4BFA-83E9-738809E2EE1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
151 | {15A9DB71-56F5-4BFA-83E9-738809E2EE1C}.Release|Any CPU.Build.0 = Release|Any CPU
152 | {8E1DDBD7-B306-4130-9EF7-EB5081726778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
153 | {8E1DDBD7-B306-4130-9EF7-EB5081726778}.Debug|Any CPU.Build.0 = Debug|Any CPU
154 | {8E1DDBD7-B306-4130-9EF7-EB5081726778}.Release|Any CPU.ActiveCfg = Release|Any CPU
155 | {8E1DDBD7-B306-4130-9EF7-EB5081726778}.Release|Any CPU.Build.0 = Release|Any CPU
156 | {1EE5BF87-BEE2-42FD-A196-765CF05D2E13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
157 | {1EE5BF87-BEE2-42FD-A196-765CF05D2E13}.Debug|Any CPU.Build.0 = Debug|Any CPU
158 | {1EE5BF87-BEE2-42FD-A196-765CF05D2E13}.Release|Any CPU.ActiveCfg = Release|Any CPU
159 | {1EE5BF87-BEE2-42FD-A196-765CF05D2E13}.Release|Any CPU.Build.0 = Release|Any CPU
160 | {A0651637-7897-46B9-8646-D6F8CB428912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
161 | {A0651637-7897-46B9-8646-D6F8CB428912}.Debug|Any CPU.Build.0 = Debug|Any CPU
162 | {A0651637-7897-46B9-8646-D6F8CB428912}.Release|Any CPU.ActiveCfg = Release|Any CPU
163 | {A0651637-7897-46B9-8646-D6F8CB428912}.Release|Any CPU.Build.0 = Release|Any CPU
164 | {3C590765-B5FD-4969-BE06-D829D2E06A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
165 | {3C590765-B5FD-4969-BE06-D829D2E06A12}.Debug|Any CPU.Build.0 = Debug|Any CPU
166 | {3C590765-B5FD-4969-BE06-D829D2E06A12}.Release|Any CPU.ActiveCfg = Release|Any CPU
167 | {3C590765-B5FD-4969-BE06-D829D2E06A12}.Release|Any CPU.Build.0 = Release|Any CPU
168 | {FDCE7091-7047-4084-B8CC-948A75ABDDDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
169 | {FDCE7091-7047-4084-B8CC-948A75ABDDDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
170 | {FDCE7091-7047-4084-B8CC-948A75ABDDDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
171 | {FDCE7091-7047-4084-B8CC-948A75ABDDDF}.Release|Any CPU.Build.0 = Release|Any CPU
172 | {A503BFB9-F911-41A2-A4DA-ADB4069A39E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
173 | {A503BFB9-F911-41A2-A4DA-ADB4069A39E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
174 | {A503BFB9-F911-41A2-A4DA-ADB4069A39E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
175 | {A503BFB9-F911-41A2-A4DA-ADB4069A39E2}.Release|Any CPU.Build.0 = Release|Any CPU
176 | {EF0822F7-1C29-4845-A180-D68F52E4AA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
177 | {EF0822F7-1C29-4845-A180-D68F52E4AA14}.Debug|Any CPU.Build.0 = Debug|Any CPU
178 | {EF0822F7-1C29-4845-A180-D68F52E4AA14}.Release|Any CPU.ActiveCfg = Release|Any CPU
179 | {EF0822F7-1C29-4845-A180-D68F52E4AA14}.Release|Any CPU.Build.0 = Release|Any CPU
180 | {0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
181 | {0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
182 | {0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
183 | {0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6}.Release|Any CPU.Build.0 = Release|Any CPU
184 | {2BFB8143-C7BE-4E55-B652-05E5CDD06115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
185 | {2BFB8143-C7BE-4E55-B652-05E5CDD06115}.Debug|Any CPU.Build.0 = Debug|Any CPU
186 | {2BFB8143-C7BE-4E55-B652-05E5CDD06115}.Release|Any CPU.ActiveCfg = Release|Any CPU
187 | {2BFB8143-C7BE-4E55-B652-05E5CDD06115}.Release|Any CPU.Build.0 = Release|Any CPU
188 | {5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
189 | {5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
190 | {5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
191 | {5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2}.Release|Any CPU.Build.0 = Release|Any CPU
192 | {24807BD9-4DBE-4CEB-956F-811053D27A0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
193 | {24807BD9-4DBE-4CEB-956F-811053D27A0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
194 | {24807BD9-4DBE-4CEB-956F-811053D27A0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
195 | {24807BD9-4DBE-4CEB-956F-811053D27A0F}.Release|Any CPU.Build.0 = Release|Any CPU
196 | {71FF58AC-E6E4-43C0-9B61-21CBECB0295F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
197 | {71FF58AC-E6E4-43C0-9B61-21CBECB0295F}.Debug|Any CPU.Build.0 = Debug|Any CPU
198 | {71FF58AC-E6E4-43C0-9B61-21CBECB0295F}.Release|Any CPU.ActiveCfg = Release|Any CPU
199 | {71FF58AC-E6E4-43C0-9B61-21CBECB0295F}.Release|Any CPU.Build.0 = Release|Any CPU
200 | {C684B99B-0453-45A3-A26A-93E0F393935D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
201 | {C684B99B-0453-45A3-A26A-93E0F393935D}.Debug|Any CPU.Build.0 = Debug|Any CPU
202 | {C684B99B-0453-45A3-A26A-93E0F393935D}.Release|Any CPU.ActiveCfg = Release|Any CPU
203 | {C684B99B-0453-45A3-A26A-93E0F393935D}.Release|Any CPU.Build.0 = Release|Any CPU
204 | {2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
205 | {2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675}.Debug|Any CPU.Build.0 = Debug|Any CPU
206 | {2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675}.Release|Any CPU.ActiveCfg = Release|Any CPU
207 | {2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675}.Release|Any CPU.Build.0 = Release|Any CPU
208 | {63BE429B-AA85-4ADE-A980-5665F06D8FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
209 | {63BE429B-AA85-4ADE-A980-5665F06D8FDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
210 | {63BE429B-AA85-4ADE-A980-5665F06D8FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
211 | {63BE429B-AA85-4ADE-A980-5665F06D8FDC}.Release|Any CPU.Build.0 = Release|Any CPU
212 | {B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
213 | {B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E}.Debug|Any CPU.Build.0 = Debug|Any CPU
214 | {B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E}.Release|Any CPU.ActiveCfg = Release|Any CPU
215 | {B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E}.Release|Any CPU.Build.0 = Release|Any CPU
216 | {06E11B85-2BDB-49A2-9BED-90633F6F5C92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
217 | {06E11B85-2BDB-49A2-9BED-90633F6F5C92}.Debug|Any CPU.Build.0 = Debug|Any CPU
218 | {06E11B85-2BDB-49A2-9BED-90633F6F5C92}.Release|Any CPU.ActiveCfg = Release|Any CPU
219 | {06E11B85-2BDB-49A2-9BED-90633F6F5C92}.Release|Any CPU.Build.0 = Release|Any CPU
220 | {229505C3-A4BF-4F8A-BC05-EB15E7A85996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
221 | {229505C3-A4BF-4F8A-BC05-EB15E7A85996}.Debug|Any CPU.Build.0 = Debug|Any CPU
222 | {229505C3-A4BF-4F8A-BC05-EB15E7A85996}.Release|Any CPU.ActiveCfg = Release|Any CPU
223 | {229505C3-A4BF-4F8A-BC05-EB15E7A85996}.Release|Any CPU.Build.0 = Release|Any CPU
224 | {5B646387-A7B1-43B3-A8C5-93A1BB5B1E64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
225 | {5B646387-A7B1-43B3-A8C5-93A1BB5B1E64}.Debug|Any CPU.Build.0 = Debug|Any CPU
226 | {5B646387-A7B1-43B3-A8C5-93A1BB5B1E64}.Release|Any CPU.ActiveCfg = Release|Any CPU
227 | {5B646387-A7B1-43B3-A8C5-93A1BB5B1E64}.Release|Any CPU.Build.0 = Release|Any CPU
228 | {59504D1A-283B-4B08-B13C-FE8E8F10F3D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
229 | {59504D1A-283B-4B08-B13C-FE8E8F10F3D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
230 | {59504D1A-283B-4B08-B13C-FE8E8F10F3D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
231 | {59504D1A-283B-4B08-B13C-FE8E8F10F3D4}.Release|Any CPU.Build.0 = Release|Any CPU
232 | {6C2D7E56-1653-454E-A9B9-F5CFA850B9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
233 | {6C2D7E56-1653-454E-A9B9-F5CFA850B9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
234 | {6C2D7E56-1653-454E-A9B9-F5CFA850B9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
235 | {6C2D7E56-1653-454E-A9B9-F5CFA850B9B1}.Release|Any CPU.Build.0 = Release|Any CPU
236 | EndGlobalSection
237 | GlobalSection(SolutionProperties) = preSolution
238 | HideSolutionNode = FALSE
239 | EndGlobalSection
240 | GlobalSection(NestedProjects) = preSolution
241 | {D8816D66-415A-4306-A81E-F23961EB9A19} = {3F96C913-2334-4A9D-AB71-999C561D851C}
242 | {865BA8E9-B068-4F6E-885B-8064F4FA4284} = {D8816D66-415A-4306-A81E-F23961EB9A19}
243 | {28E2920C-1E0A-4413-8BB7-C1CD025E5412} = {D8816D66-415A-4306-A81E-F23961EB9A19}
244 | {32EDD1F6-BE5B-465C-9BAF-1A550F4E0971} = {D8816D66-415A-4306-A81E-F23961EB9A19}
245 | {3882E3BC-8131-408D-ADCA-3F00A3075A52} = {D8816D66-415A-4306-A81E-F23961EB9A19}
246 | {4CA9F4C3-DA08-43B5-96A0-D30D86BB956C} = {D8816D66-415A-4306-A81E-F23961EB9A19}
247 | {68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF} = {3F96C913-2334-4A9D-AB71-999C561D851C}
248 | {4C1D8072-3C00-4929-AB0C-AF608E3D6CCB} = {68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF}
249 | {2365ADE6-11BC-41B5-812A-72B988882DD7} = {68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF}
250 | {E445A9DE-9B0D-4EF7-AD70-C6F80BED1758} = {68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF}
251 | {89990351-7A92-4E64-9362-5A6362FBF5A4} = {68CB5AF1-AA7E-422F-BD5F-8B2A1F9BE4CF}
252 | {1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1} = {3F96C913-2334-4A9D-AB71-999C561D851C}
253 | {C03ADAFA-D08D-483E-80AF-686C88934A5C} = {1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1}
254 | {FF765491-EB76-4880-BEC8-0BE77403E2D1} = {1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1}
255 | {AFF0D5CC-12B7-4275-87FD-FDE36515AC07} = {1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1}
256 | {15A9DB71-56F5-4BFA-83E9-738809E2EE1C} = {1CAF696F-1BE4-4F7E-9C8C-B3C0A73C3CE1}
257 | {E824A57C-4950-43A7-BFCD-4D5DA7A84779} = {3F96C913-2334-4A9D-AB71-999C561D851C}
258 | {8E1DDBD7-B306-4130-9EF7-EB5081726778} = {E824A57C-4950-43A7-BFCD-4D5DA7A84779}
259 | {1EE5BF87-BEE2-42FD-A196-765CF05D2E13} = {E824A57C-4950-43A7-BFCD-4D5DA7A84779}
260 | {A0651637-7897-46B9-8646-D6F8CB428912} = {E824A57C-4950-43A7-BFCD-4D5DA7A84779}
261 | {3C590765-B5FD-4969-BE06-D829D2E06A12} = {E824A57C-4950-43A7-BFCD-4D5DA7A84779}
262 | {FDCE7091-7047-4084-B8CC-948A75ABDDDF} = {E824A57C-4950-43A7-BFCD-4D5DA7A84779}
263 | {57932C51-07BF-4FC7-BA4D-31CB1B98172B} = {28B0273A-72D2-4D0A-BC51-8B8A81BDAEC2}
264 | {A503BFB9-F911-41A2-A4DA-ADB4069A39E2} = {57932C51-07BF-4FC7-BA4D-31CB1B98172B}
265 | {EF0822F7-1C29-4845-A180-D68F52E4AA14} = {57932C51-07BF-4FC7-BA4D-31CB1B98172B}
266 | {0FCACCBF-83EE-4EF6-94DE-B45CAED4C6E6} = {57932C51-07BF-4FC7-BA4D-31CB1B98172B}
267 | {2BFB8143-C7BE-4E55-B652-05E5CDD06115} = {57932C51-07BF-4FC7-BA4D-31CB1B98172B}
268 | {5ADB3DA3-B3CC-4668-8963-5A02EE3AB7A2} = {57932C51-07BF-4FC7-BA4D-31CB1B98172B}
269 | {2065B529-ECBF-4C13-BDED-E8C3E69187BA} = {28B0273A-72D2-4D0A-BC51-8B8A81BDAEC2}
270 | {24807BD9-4DBE-4CEB-956F-811053D27A0F} = {2065B529-ECBF-4C13-BDED-E8C3E69187BA}
271 | {71FF58AC-E6E4-43C0-9B61-21CBECB0295F} = {2065B529-ECBF-4C13-BDED-E8C3E69187BA}
272 | {C684B99B-0453-45A3-A26A-93E0F393935D} = {2065B529-ECBF-4C13-BDED-E8C3E69187BA}
273 | {9BEE2F4C-2B67-4938-AA7C-C09574A0A8BF} = {28B0273A-72D2-4D0A-BC51-8B8A81BDAEC2}
274 | {2E9EE0DA-FB5D-424F-8FE0-E667CAFD8675} = {9BEE2F4C-2B67-4938-AA7C-C09574A0A8BF}
275 | {63BE429B-AA85-4ADE-A980-5665F06D8FDC} = {9BEE2F4C-2B67-4938-AA7C-C09574A0A8BF}
276 | {B86C9EF3-C5B9-4A9D-B10B-C3E77634D29E} = {9BEE2F4C-2B67-4938-AA7C-C09574A0A8BF}
277 | {1867716F-7531-4CB2-8098-1F46F365E5AB} = {28B0273A-72D2-4D0A-BC51-8B8A81BDAEC2}
278 | {06E11B85-2BDB-49A2-9BED-90633F6F5C92} = {1867716F-7531-4CB2-8098-1F46F365E5AB}
279 | {229505C3-A4BF-4F8A-BC05-EB15E7A85996} = {1867716F-7531-4CB2-8098-1F46F365E5AB}
280 | {5B646387-A7B1-43B3-A8C5-93A1BB5B1E64} = {1867716F-7531-4CB2-8098-1F46F365E5AB}
281 | {59504D1A-283B-4B08-B13C-FE8E8F10F3D4} = {1867716F-7531-4CB2-8098-1F46F365E5AB}
282 | {6C2D7E56-1653-454E-A9B9-F5CFA850B9B1} = {1867716F-7531-4CB2-8098-1F46F365E5AB}
283 | EndGlobalSection
284 | GlobalSection(ExtensibilityGlobals) = postSolution
285 | SolutionGuid = {EE747DBE-A0EF-4096-9F11-8161F8AAB93D}
286 | EndGlobalSection
287 | EndGlobal
288 |
--------------------------------------------------------------------------------