C# FULL NOTES
1. Overview & Setup
--------------------
- C# is a modern, object-oriented language by Microsoft.
- Used in desktop apps, web, mobile, games, IoT, and cloud.
- IDEs: Visual Studio, VS Code + .NET SDK.
2. Projects & Files
---------------------
- Create: dotnet new console -n MyApp
- Run: dotnet run
- .csproj: project file describing dependencies, targets.
3. Namespaces & Assemblies
----------------------------
- namespace MyApp { ... }
- using directive to include namespaces.
- Assemblies are compiled code (DLL/EXE).
4. Data Types & Variables
---------------------------
- int, float, double, char, string, bool, etc.
- Nullable: int? x = null;
- var keyword for type inference.
5. Operators
-------------
- Arithmetic: + - * / %
- Comparison: == != > < >= <=
- Logical: && || !
- Assignment: = += -= *=
6. Control Statements
----------------------
- if, else if, else, switch-case.
- Loops: for, while, do-while, foreach.
- break, continue, return, goto.
7. Methods & Functions
------------------------
- Syntax: returnType MethodName(parameters) { }
- Overloading, recursion, optional/default params.
8. Classes & OOP
------------------
- class, objects, properties, methods.
- Constructors, destructors, static, this.
- Partial classes, access modifiers.
9. Inheritance & Polymorphism
------------------------------
- class B : A { }
- virtual, override, new.
- abstract classes & interfaces.
10. Structs & Enums
--------------------
- struct Point { int x, y; }
- enum Color { Red, Green, Blue };
11. Generics
-------------
- class Box<T> { T item; }
- Generic methods, constraints.
12. Delegates & Events
------------------------
- delegate void MyDelegate();
- event EventHandler Clicked;
- Lambda: (x, y) => x + y
13. Collections & LINQ
------------------------
- List<T>, Dictionary<K,V>, HashSet<T>
- LINQ: from x in list where x > 10 select x;
14. Exception Handling
------------------------
- try, catch, finally, throw.
- Multiple catch blocks.
- Custom exceptions.
15. File I/O
-------------
- File.ReadAllText(), File.WriteAllText()
- StreamReader, StreamWriter, BinaryReader
16. Async & Multithreading
----------------------------
- async Task Method(), await.
- Task.Run, Thread, lock, Mutex
17. Advanced Topics
---------------------
- Attributes, reflection, dynamic, records.
- Pattern matching, switch expressions.
- Span<T>, Memory<T>
18. .NET Libraries
--------------------
- System, System.IO, System.Net, System.Linq
- Use NuGet packages for 3rd-party libraries
19. Testing & Debugging
-------------------------
- Unit testing: MSTest, xUnit, NUnit
- Breakpoints, call stack, watch window.
20. Best Practices
--------------------
- SOLID principles, design patterns.
- Clean code, dependency injection.
- Use meaningful names, proper formatting.
Thank you for reading!