Learn C# through real-world examples and hands-on code snippets
This repository contains a wide collection of C# programs and code samples covering essential programming concepts—from beginner-level syntax to advanced topics like inheritance, exceptions, file I/O, LINQ, unit testing, and more.
- Repository Overview
- Folder Structure & Topics
- Getting Started
- Example Walkthroughs
- Running Code Samples
- Adding New Examples
- Contributing
- Project Roadmap
- About the Author
- Contact
This collection includes:
- Fundamental C# programs (e.g., loops, arrays, strings, methods)
- Object-oriented concepts (classes, constructors, interfaces, inheritance, polymorphism, encapsulation)
- Exception handling and propagation
- File and directory operations (reading, writing, configuration)
- Advanced C# features (delegates, enums, LINQ, unit testing frameworks like NUnit and xUnit)
- Debugging examples and sample Console applications
Perfect for learners building skills step-by-step or anyone looking for reference implementations.
Here are some of the key directories/examples you’ll find:
- FirstConsoleProgram, SecondConsoleProgram, BasicPrograms: Intro-level console-based examples
- Loops, ArraysExamples, ArrayAndLists: Fundamental data structure & flow control examples
- CSharpStrings, InbuiltMethods, FunctionsCSharp: String manipulation and method usage
- ClassExample, CsharpConstructor: Defining classes, constructors, and object instantiation
- Inheritance, CSharpInheritancePolymorphism, DelegateExamples, Enums: OOP depth examples including inheritance, polymorphism, delegates, and enums
- ExceptionPractice, ExceptionPropagationandNonPropagationToStack: Exception handling strategies and flow
- FilesReadWrite, FileDirectoryExample, ReadingConfigurationFile: File I/O and configuration usage
- LinqExampleCSharp: LINQ queries over collections
- CSharpUnitTestPractice, ConsoleCalculator.XunitTest, ConsoleCalculatorTest.Nunit: Unit testing patterns using NUnit and xUnit
To begin working with these examples:
- Clone the repository
git clone https://github.com/gsudarshan1990/CSharpProgram.git cd CSharpProgram