C# CONSOLE APPLICATION – BASIC SECTION NOTES
--------------------------------------------
1. INTRODUCTION TO C#
- C# is an object-oriented programming language developed by Microsoft.
- Used for building Windows apps, web apps, games, etc.
- Combines power of C++ and ease of Java.
2. DATA TYPES IN C#
- Value types: int, float, bool, char, etc.
- Reference types: string, object, arrays, class, etc.
3. DATA TYPE CONVERSION
- Implicit: automatic (safe)
- Explicit: using casting (may lose data)
- Convert class: Convert.ToInt32(), Convert.ToDouble()
- Parse/TryParse for strings
4. VALUE AND REFERENCE
- Value types: stored in stack (copy of data)
- Reference types: stored in heap (reference to data)
5. VALUE TYPE VS REFERENCE TYPE
- Value: int, float, char → stored directly
- Reference: arrays, classes → stored via address
6. VAR AND DYNAMIC
- var: compile-time type inference
- dynamic: runtime binding
7. CONSTANT IN C#
- Use "const" for fixed value that can't change
8. STATEMENT OPERATORS
- Arithmetic: + - * /
- Comparison: == != < > <= >=
- Logical: && || !
9. SELECTION CONSTRUCTS
- if, if-else, nested if, switch
10. LOOPING CONSTRUCTS
- for, while, do-while, foreach
11. METHODS OR FUNCTIONS
- Code blocks that perform actions
- Can return values or be void
- Parameters, overloading, recursion
12. CLASS AND OBJECTS
- Class: blueprint
- Object: instance of class
- Members: fields, methods, properties
13. ACCESS SPECIFIERS
- private, public, protected, internal, protected internal
14. ARRAYS
- Single-dimension, multi-dimension, jagged arrays
- foreach loop
- Length property
15. CONSTRUCTOR
- Special method with same name as class
- Used to initialize object
- Types: default, parameterized, static, private, copy
16. COPY CONSTRUCTOR
- Create new object by copying another
- Syntax: ClassName(ClassName obj)
17. CONSTRUCTOR OVERLOADING
- Multiple constructors with different parameters
18. CONSTRUCTORS IN C#
- Full overview of all constructor types
19. CONSTRUCTOR IN INHERITANCE
- Base constructor is called first
- Use "base()" to call parent constructor
20. REF AND OUT
- ref: pass by reference (must be initialized)
- out: return multiple values (don't need init)
21. CONVERSION
- Implicit, explicit, Convert, Parse, TryParse
22. BOXING AND UNBOXING
- Boxing: value ➝ object
- Unboxing: object ➝ value
23. STATIC AND INSTANCE MEMBERS
- Static: belongs to class
- Instance: belongs to object
- Access static using ClassName.Member