Welcome to the C# Compact Course repository! This repository contains comprehensive learning materials covering fundamental to advanced topics in C# programming, curated by Elliot One. The course is designed to provide hands-on experience through practical examples and exercises.
- Visual Studio 2022 or later (recommended)
- .NET 6.0 SDK or later
- .NET Framework 4.7.2 (for GUI Programming module)
- Basic understanding of programming concepts
-
- Variables and data types (int, double, string, char, bool)
- Variable initialization and assignment
- Operators and expressions (arithmetic, comparison, logical)
- Type conversion and casting (implicit and explicit)
- String interpolation
- Constants and readonly fields
- Nullable types
-
- If statements
- If-Else statements
- Else-If chains
- Switch statements
- Ternary operator
- For loops
- While loops
- Do-While loops
- Break and Continue statements
- Nested loops
-
- Single-dimensional arrays
- Multi-dimensional arrays
- Jagged arrays
- Array manipulation and iteration
- Lists (List<T>)
- Dictionaries (Dictionary<TKey, TValue>)
- HashSets (HashSet<T>)
- Queues and Stacks
- Collection initialization
- Common collection operations
-
- Method declaration and definition
- Method parameters (value, ref, out)
- Return values
- Method overloading
- Optional parameters
- Named arguments
- Recursive methods
- Expression-bodied members
- Local functions
- Extension methods
-
- Classes and objects
- Encapsulation
- Access modifiers (public, private, protected, internal)
- Properties and fields
- Auto-implemented properties
- Inheritance
- Base and derived classes
- Method overriding
- Virtual and override keywords
- Base keyword
- Polymorphism
- Method overriding
- Abstract classes and methods
- Interfaces
- Constructors and destructors
-
- Try-Catch blocks
- Multiple catch blocks
- Finally block
- Throwing exceptions
- Custom exceptions
- Exception properties
- Best practices for exception handling
- Practical example: Bank account with custom InsufficientFundsException
-
- Reading from text files
- File.ReadAllText()
- File.ReadAllLines()
- StreamReader
- Writing to text files
- File.WriteAllText()
- File.WriteAllLines()
- StreamWriter
- Appending to files
- File and directory operations
- Path manipulation
- Using statements and IDisposable
- Error handling in file operations
- Reading from text files
-
- Windows Forms introduction
- Creating a simple GUI application
- Controls (TextBox, Button, Label)
- Event handling
- Practical project: Quadratic equation solver
- Input validation
- Mathematical calculations
- Displaying results
- Note: Uses .NET Framework 4.7.2
-
- Console.WriteLine() debugging
- Breakpoints
- Step Over, Step Into, Step Out
- Watch windows
- Locals and Autos windows
- Call stack
- Conditional breakpoints
- Debug vs Release builds
- Common debugging scenarios
-
- LINQ query syntax
- LINQ method syntax
- Querying collections
- Filtering data (Where)
- Selecting and transforming data (Select)
- Ordering data (OrderBy, OrderByDescending)
- Grouping data (GroupBy)
- Aggregation operations (Sum, Average, Count, Min, Max)
- Joining data
- Deferred execution
- Practical examples with various data types
-
- Introduction to async/await
- Async methods
- Task and Task<T>
- Awaiting asynchronous operations
- Async void vs async Task
- Exception handling in async methods
- Practical examples:
- Simulating long-running operations
- Asynchronous file I/O
- Multiple concurrent operations
- Task.WhenAll and Task.WhenAny
-
- Stack vs Heap memory
- Value types vs Reference types
- Garbage collection
- IDisposable interface
- Using statement
- Dispose pattern
- Finalizers
- Memory leaks prevention
- Best practices for resource management
-
- Introduction to unit testing
- MSTest framework
- Test attributes ([TestClass], [TestMethod])
- Assertions (Assert.AreEqual, Assert.IsTrue, etc.)
- Test organization
- Testing best practices
- Practical test examples:
- Calculator tests
- String utility tests
- Math utility tests
- Counter tests
- Testing private methods
git clone <repository-url>
cd "C# Compact Course"- Open
C# Compact Course.slnin Visual Studio - The solution contains 13 projects, one for each session
- Set the desired project as the startup project (right-click → Set as Startup Project)
- Press F5 to run the project
Each session is a standalone console application (except Session 8 which is a Windows Forms application). You can:
- Navigate to the specific session folder
- Review the code examples
- Run the project to see the output
- Modify the code to experiment with different concepts
C# Compact Course/
├── 1.BasicSyntaxAndDataTypes/
├── 2.ControlFlowAndDecisionMaking/
├── 3.ArraysAndCollections/
├── 4.FunctionsAndMethods/
├── 5.Object-OrientedProgrammingBasics/
├── 6.ExceptionHandling/
├── 7.FileIO/
├── 8.GUIProgrammingBasics/
├── 9.BasicDebuggingTechniques/
├── 10.IntroductionToLINQ/
├── 11.AsynchronousProgrammingBasics/
├── 12.MemoryManagementBasics/
├── 13.UnitTesting/
├── C# Compact Course.sln
├── LICENSE.txt
└── README.md
This course is designed to be followed sequentially, as each session builds upon concepts from previous sessions:
- Foundations (Sessions 1-4): Core syntax, control flow, data structures, and functions
- Object-Oriented Programming (Session 5): Classes, inheritance, polymorphism, and encapsulation
- Error Handling & I/O (Sessions 6-7): Exception handling and file operations
- Application Development (Sessions 8-9): GUI programming and debugging
- Advanced Topics (Sessions 10-13): LINQ, async programming, memory management, and testing
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Elliot One
Happy Coding! 🚀