Skip to content

ChathuraHS/gradebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GradeBook — C# Fundamentals Reference Project

Based on the C# Fundamentals course by Scott Allen. Annotated for learning.


Project Structure

GradeBook/
├── GradeBook.sln                        # Solution file (groups both projects)
│
├── src/
│   └── GradeBook/                       # Main console application
│       ├── GradeBook.csproj
│       ├── Program.cs                   # Entry point (top-level statements, C# 9+)
│       ├── Delegates.cs                 # GradeAddedDelegate definition
│       ├── IBook.cs                     # IBook interface
│       ├── NamedObject.cs               # Base class with Name property
│       ├── Book.cs                      # Abstract class extending NamedObject
│       ├── InMemoryBook.cs              # Concrete implementation (grades stored in List<double>)
│       └── Statistics.cs               # Data class for computed grade statistics
│
└── test/
    └── GradeBook.Tests/                 # xUnit test project
        ├── GradeBook.Tests.csproj
        ├── BookTests.cs                 # Tests for grade calculation logic
        └── TypeTests.cs                 # Tests demonstrating C# type system concepts

How to Run

# Run the console app (interactive grade entry)
cd src/GradeBook
dotnet run

# Run all tests
cd test/GradeBook.Tests
dotnet test

# Or from solution root
dotnet test GradeBook.sln

Key C# Concepts Covered (with file locations)

Concept File
Delegates & Events Delegates.cs, IBook.cs, InMemoryBook.cs, Program.cs
Interfaces IBook.cs
Abstract classes Book.cs
Inheritance & base() chaining NamedObject.csBook.csInMemoryBook.cs
Method overloading InMemoryBook.cs (two AddGrade overloads)
ref / out parameters TypeTests.cs
Value types vs reference types TypeTests.cs
String immutability TypeTests.cs
Multicast delegates TypeTests.cs
switch with pattern matching InMemoryBook.cs
try / catch / finally Program.cs
List<T> generics InMemoryBook.cs
const InMemoryBook.cs
Top-level statements Program.cs
xUnit [Fact] tests BookTests.cs, TypeTests.cs
nameof() & string interpolation InMemoryBook.cs

Why This Structure?

  • NamedObject — reusable base for anything with a name
  • Book (abstract) — enforces that all book types implement AddGrade and GetStatistics
  • IBook (interface) — lets Program.cs and tests work with any book type without coupling to InMemoryBook
  • InMemoryBook — the concrete grade store; a future DiskBook could be added without changing any calling code

About

C# fundamentals reference project covers OOP, delegates, events, generics, and unit testing with xUnit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages