Object-Oriented Programming (OOP) Concepts in C#

 


    <style>

        body {

      font-family: 'Segoe UI', sans-serif;

      color: #333;

    }

h1 {

      line-height: 1.6;

    }

        h1 {

            text-align: center;

        }

        h2 {

            color: #333366;

            border-bottom: 2px solid #ddd;

            padding-bottom: 5px;

        }

        ul {

            margin-left: 20px;

        }

        .section {

            margin-bottom: 30px;

            padding: 15px;

            background: #fff;

            border-radius: 5px;

            box-shadow: 0 2px 4px rgba(0,0,0,0.1);

        }

    </style>


    <div class="section">

        <h2>Class</h2>

        <ul>

            <li>A blueprint that defines properties and methods.</li>

            <li>Used to create objects.</li>

            <li>Does not hold actual data itself.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Object</h2>

        <ul>

            <li>A specific instance of a class.</li>

            <li>Holds data and can use the methods defined in its class.</li>

            <li>Core unit of OOP that represents real-world entities.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Multilevel Inheritance</h2>

        <ul>

            <li>A class inherits from another class, which in turn inherits from a third class.</li>

            <li>This forms a chain of inheritance where functionality is passed down through multiple levels.</li>

            <li>Useful for creating specialized versions of base functionality.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Hierarchical Inheritance</h2>

        <ul>

            <li>Multiple classes inherit from a single base class.</li>

            <li>Encourages reuse of common logic in derived classes.</li>

            <li>The base class acts as a parent, and multiple child classes share its behavior.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Fields</h2>

        <ul>

            <li>Variables declared inside a class or struct to store data.</li>

            <li>Usually kept private to maintain encapsulation.</li>

            <li>Can be initialized with default values and used internally by the class.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Properties</h2>

        <ul>

            <li>Members of a class that provide controlled access to fields.</li>

            <li>Often used for reading and writing private data.</li>

            <li>Can include logic in the get or set methods to enforce validation or rules.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Inheritance</h2>

        <ul>

            <li>Allows one class to inherit from another.</li>

            <li>Promotes code reuse and represents "is-a" relationships.</li>

            <li>Supports single, multilevel, and hierarchical inheritance.</li>

            <li>.NET allows multiple interface inheritance, not multiple class inheritance.</li>

            <li>Uses keywords like base, virtual, and override.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Abstraction</h2>

        <ul>

            <li>Hides complex internal details.</li>

            <li>Focuses on essential features.</li>

            <li>Achieved using abstract classes and interfaces.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Encapsulation</h2>

        <ul>

            <li>Restricts direct access to internal object data.</li>

            <li>Uses access modifiers like private, public, and protected.</li>

            <li>Uses properties (getters and setters) for data access.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Polymorphism</h2>

        <ul>

            <li>Enables methods to take many forms.</li>

            <li>Includes compile-time polymorphism (overloading) and runtime polymorphism (overriding).</li>

            <li>Enhances flexibility and extensibility.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Interface</h2>

        <ul>

            <li>A contract with only method and property signatures.</li>

            <li>Allows multiple inheritance of behavior.</li>

            <li>Promotes loose coupling.</li>

            <li>All members are abstract and public by default.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Composition</h2>

        <ul>

            <li>One class contains objects of another class.</li>

            <li>Uses functionality of other classes instead of inheriting from them.</li>

            <li>Promotes flexibility and modular design.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Delegates and Events</h2>

        <ul>

            <li>Delegates are type-safe method pointers.</li>

            <li>Events are based on delegates and follow the publisher-subscriber model.</li>

            <li>Used for callbacks and event-driven programming.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Generics</h2>

        <ul>

            <li>Allow defining data types as parameters in classes and methods.</li>

            <li>Provide type safety, reusability, and performance.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Exception Handling</h2>

        <ul>

            <li>Manages runtime errors using try, catch, and finally blocks.</li>

            <li>Ensures robust and fault-tolerant code.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Namespaces</h2>

        <ul>

            <li>Organize code into logical groups.</li>

            <li>Prevent naming conflicts.</li>

            <li>Improve modularity and readability.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Attributes</h2>

        <ul>

            <li>Metadata applied to code elements like classes, methods, and properties.</li>

            <li>Used for features like serialization, validation, and documentation.</li>

        </ul>

    </div>

    <div class="section">

        <h2>LINQ (Language Integrated Query)</h2>

        <ul>

            <li>Enables querying collections, databases, XML, and more.</li>

            <li>Improves code readability and reduces boilerplate.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Async/Await and Task-Based Asynchronous Programming</h2>

        <ul>

            <li>Simplifies writing asynchronous code.</li>

            <li>Improves responsiveness in I/O-bound and UI-heavy applications.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Dependency Injection (DI)</h2>

        <ul>

            <li>Injects dependencies into a class rather than hardcoding them.</li>

            <li>Promotes testability and loose coupling.</li>

            <li>Supported by .NET Core using IServiceCollection and IServiceProvider.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Lambda Expressions and Anonymous Methods</h2>

        <ul>

            <li>Concise way to define inline functions.</li>

            <li>Commonly used with LINQ and event handling.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Partial Classes and Methods</h2>

        <ul>

            <li>Split a single class or method into multiple files.</li>

            <li>Useful in auto-generated code and large applications.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Extension Methods</h2>

        <ul>

            <li>Add new methods to existing types without modifying them.</li>

            <li>Commonly used for utility and helper methods.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Records and Immutable Types</h2>

        <ul>

            <li>Introduced in C# 9.</li>

            <li>Records are immutable reference types with value-based equality.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Pattern Matching</h2>

        <ul>

            <li>Allows concise checking of types and values.</li>

            <li>Enhances readability in conditionals and switch expressions.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Memory Management and IDisposable</h2>

        <ul>

            <li>.NET uses garbage collection for automatic memory management.</li>

            <li>IDisposable is implemented for releasing unmanaged resources.</li>

            <li>The using statement ensures proper resource disposal.</li>

        </ul>

    </div>

    <div class="section">

        <h2>ref</h2>

        <ul>

            <li>Passes a parameter by reference.</li>

            <li>Variable must be initialized before passing.</li>

            <li>Allows modification of the original value.</li>

        </ul>

    </div>

    <div class="section">

        <h2>out</h2>

        <ul>

            <li>Also passes by reference, typically used to return multiple values.</li>

            <li>Variable need not be initialized before passing.</li>

            <li>Must be assigned a value inside the method.</li>

        </ul>

    </div>

    <div class="section">

        <h2>partial class</h2>

        <ul>

            <li>Allows a class to be defined across multiple files.</li>

            <li>All parts are merged during compilation.</li>

            <li>Helps manage large classes and generated code.</li>

        </ul>

    </div>

    <div class="section">

        <h2>sealed class</h2>

        <ul>

            <li>Prevents further inheritance.</li>

            <li>Improves performance and control over class design.</li>

        </ul>

    </div>

    <div class="section">

        <h2>static class</h2>

        <ul>

            <li>Cannot be instantiated.</li>

            <li>Contains only static members.</li>

            <li>Ideal for utility or helper methods.</li>

        </ul>

    </div>

    <div class="section">

        <h2>constructor</h2>

        <ul>

            <li>Initializes a new object.</li>

            <li>Can be default, parameterized, or static.</li>

            <li>Sets initial values or performs setup tasks.</li>

        </ul>

    </div>

<div class="section">

        <h2>Extension Method</h2>

        <ul>

            <li>Adds methods to existing types without modifying their source.</li>

            <li>Enables cleaner and modular code reuse.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Collections</h2>

        <ul>

            <li>Store and manage groups of related data.</li>

            <li>Common types include List, Dictionary, Queue, and Stack.</li>

            <li>Support dynamic sizing, sorting, filtering, and iteration.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Properties and Indexers</h2>

        <ul>

            <li>Properties provide controlled access to class fields.</li>

            <li>Include get and set accessors.</li>

            <li>Can implement logic inside accessors (e.g., validation).</li>

            <li>Indexers allow accessing class objects like arrays using index notation.</li>

            <li>Useful when a class logically represents a collection or list.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Static Members</h2>

        <ul>

            <li>Belong to the type itself, not to any instance.</li>

            <li>Shared across all instances of the class.</li>

            <li>Can include fields, properties, methods, and constructors.</li>

            <li>Useful for utilities, constants, and global state.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Type Casting</h2>

        <ul>

            <li>Converts one data type to another.</li>

            <li>Can be implicit (safe and automatic) or explicit (requires cast operator).</li>

            <li>Helps in polymorphic scenarios and interfacing with different types.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Nested Classes</h2>

        <ul>

            <li>A class defined within another class.</li>

            <li>Can access members of the outer class, including private members.</li>

            <li>Useful for logically grouping helper or tightly coupled functionality.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Abstract Classes</h2>

        <ul>

            <li>Cannot be instantiated directly.</li>

            <li>Serve as base classes for derived types.</li>

            <li>May contain both abstract methods (no implementation) and concrete methods.</li>

            <li>Define a common template for derived classes.</li>

        </ul>

    </div>

    <div class="section">

        <h2>new Keyword</h2>

        <ul>

            <li>Hides a member from the base class with the same name.</li>

            <li>Used in method or property declarations to explicitly indicate hiding behavior.</li>

            <li>Can also be used to create new instances of objects.</li>

        </ul>

    </div>

    <div class="section">

        <h2>base Keyword</h2>

        <ul>

            <li>Refers to the base class of the current class.</li>

            <li>Used to call base class constructors or access overridden members.</li>

            <li>Helpful for extending or reusing parent class functionality.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Events</h2>

        <ul>

            <li>Mechanism for implementing publish-subscribe or observer pattern.</li>

            <li>Built on delegates and used to signal state changes or user actions.</li>

            <li>Allow subscribers to respond to occurrences without tight coupling.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Delegates</h2>

        <ul>

            <li>Type-safe function pointers.</li>

            <li>Store references to methods with a specific signature.</li>

            <li>Can be passed as arguments, returned from methods, or used for callbacks.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Reflection</h2>

        <ul>

            <li>Enables inspection of metadata about types at runtime.</li>

            <li>Can dynamically create instances, invoke methods, or access properties.</li>

            <li>Useful in frameworks, serialization, dependency injection, and tooling.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Records</h2>

        <ul>

            <li>Introduced in C# 9 for immutable reference types.</li>

            <li>Support value-based equality comparison.</li>

            <li>Automatically implement members like equality, cloning, and deconstruction.</li>

            <li>Ideal for data transfer and read-only models.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Object Pooling</h2>

        <ul>

            <li>Reuses objects instead of creating and destroying them frequently.</li>

            <li>Reduces memory allocation and garbage collection overhead.</li>

            <li>Useful in high-performance scenarios like game development or web servers.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Immutable Objects</h2>

        <ul>

            <li>Cannot be changed after creation.</li>

            <li>All state is set via constructor and remains constant.</li>

            <li>Ensures thread safety and predictable behavior.</li>

            <li>Examples include strings and records.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Mutable Objects</h2>

        <ul>

            <li>Can change state after creation.</li>

            <li>Allow updating properties and fields.</li>

            <li>Easier to work with in dynamic or interactive systems but require careful management in multi-threaded scenarios.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Access Modifiers</h2>

        <ul>

            <li>public – Accessible from anywhere.</li>

            <li>private – Accessible only within the same class.</li>

            <li>protected – Accessible within the same class and derived classes.</li>

            <li>internal – Accessible within the same assembly.</li>

            <li>protected internal – Accessible within the same assembly or derived classes in other assemblies.</li>

        </ul>

    </div>

<div class="section">

        <h2>Static vs Instance Members</h2>

        <ul>

            <li>Static members belong to the class itself; shared across all instances.</li>

            <li>Instance members belong to a specific object instance.</li>

            <li>Static members are used for global logic or utility methods.</li>

            <li>Instance members hold unique data and behavior for each object.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Value Types</h2>

        <ul>

            <li>Store data directly.</li>

            <li>Typically allocated on the stack.</li>

            <li>Includes types like int, float, bool, and structs.</li>

            <li>Faster access but copied by value (not by reference).</li>

        </ul>

    </div>

    <div class="section">

        <h2>Reference Types</h2>

        <ul>

            <li>Store a reference to the data (address in memory).</li>

            <li>Allocated on the heap.</li>

            <li>Includes classes, interfaces, arrays, and delegates.</li>

            <li>Changes to a reference affect all references to the same object.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Object Finalization</h2>

        <ul>

            <li>Finalization is a cleanup process triggered before the object is removed from memory.</li>

            <li>Achieved by overriding the Finalize method (not recommended for most use cases).</li>

            <li>Best practice is to use the IDisposable interface and dispose pattern for deterministic cleanup.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Garbage Collection (GC)</h2>

        <ul>

            <li>Automatic memory management in .NET.</li>

            <li>Frees unused objects from memory to prevent leaks.</li>

            <li>Occurs in generations (0, 1, 2) based on object lifespan.</li>

            <li>Developers can call GC.Collect() but should do so cautiously.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Anonymous Types</h2>

        <ul>

            <li>Lightweight types created on the fly using var.</li>

            <li>Contain read-only properties with no explicit class definition.</li>

            <li>Useful in LINQ queries or temporary data grouping.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Covariance and Contravariance in Generics</h2>

        <ul>

            <li>Covariance allows a method to return a more derived type than specified (output).</li>

            <li>Enables assignment of a more derived type to a base generic interface (e.g., IEnumerable&lt;Animal&gt; from IEnumerable&lt;Dog&gt;).</li>

            <li>Contravariance allows a method to accept a more general type than specified (input).</li>

            <li>Enables assignment of a base type to a more derived generic delegate (e.g., Action&lt;Dog&gt; from Action&lt;Animal&gt;).</li>

            <li>Improves flexibility in method parameters and return types.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Readonly, Const, Let, Var</h2>

        <ul>

            <li>const: Defines compile-time constant values, must be assigned at declaration, cannot change.</li>

            <li>readonly: Runtime constant, can be assigned once during declaration or in constructor, used for instance or static fields.</li>

            <li>var: Implicitly typed local variable, type inferred at compile time, must be initialized.</li>

            <li>let: (Not a C# keyword; used in LINQ queries to introduce range variables.)</li>

        </ul>

    </div>

    <div class="section">

        <h2>Variables and Data Types</h2>

        <ul>

            <li>Variables store data and have a specific data type (int, string, bool, etc.).</li>

            <li>Strongly typed: type checked at compile time.</li>

            <li>Common types: int, double, char, bool, string, decimal, object.</li>

            <li>Type inference available with var.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Method Overloading and Overriding</h2>

        <ul>

            <li>Overloading: Same method name, different parameters within the same class.</li>

            <li>Overriding: Derived class provides specific implementation of a virtual method in base class using override.</li>

            <li>Requires base method marked virtual, abstract, or override.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Indexers</h2>

        <ul>

            <li>Allow objects to be indexed like arrays.</li>

            <li>Define get/set accessors using this keyword with parameters.</li>

            <li>Useful for custom collections or data structures.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Anonymous Methods</h2>

        <ul>

            <li>Inline unnamed methods.</li>

            <li>Syntax: delegate(parameters) { /* code */ }.</li>

            <li>Useful for event handlers and callbacks before lambdas.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Lambda Expressions</h2>

        <ul>

            <li>Concise syntax for anonymous functions: (parameters) =&gt; expression.</li>

            <li>Used heavily in LINQ, delegates, and events.</li>

            <li>Can have statement bodies with {}.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Tuples</h2>

        <ul>

            <li>Group multiple values into a single object without defining a class.</li>

            <li>Can be named or unnamed.</li>

            <li>Support deconstruction into individual variables.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Generics (classes, methods, constraints)</h2>

        <ul>

            <li>Allow type parameters in classes/methods for type safety and reuse.</li>

            <li>Constraints restrict allowed types (where T : class, where T : new(), etc.).</li>

            <li>Used in collections and utility classes.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Nullable Types and Null Coalescing Operator</h2>

        <ul>

            <li>Nullable types allow value types to hold null (int?).</li>

            <li>Null coalescing operator ?? returns left operand if not null, otherwise right operand.</li>

            <li>Simplifies null handling.</li>

        </ul>

    </div>

<div class="section">

        <h2>Dynamic Types</h2>

        <ul>

            <li>dynamic bypasses compile-time type checking.</li>

            <li>Type resolved at runtime.</li>

            <li>Useful for COM interop, reflection, or scripting scenarios.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Boxing and Unboxing</h2>

        <ul>

            <li>Boxing: converting value type to object type (heap allocation).</li>

            <li>Unboxing: converting object back to value type.</li>

            <li>Expensive operations; avoid in performance-critical code.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Value Types vs Reference Types</h2>

        <ul>

            <li>Value types: stored on stack, hold actual data (int, struct).</li>

            <li>Reference types: stored on heap, hold reference to data (class, string).</li>

            <li>Value types copied on assignment; reference types copied by reference.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Structs and Enums</h2>

        <ul>

            <li>Structs: lightweight value types, used for small data structures.</li>

            <li>Cannot have inheritance (except from interfaces).</li>

            <li>Enums: named constants of integral types.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Arrays and Multi-dimensional Arrays</h2>

        <ul>

            <li>Fixed-size collections of elements of the same type.</li>

            <li>Single-dimensional, multi-dimensional (rectangular), and jagged arrays supported.</li>

        </ul>

    </div>

    <div class="section">

        <h2>IEnumerable and IEnumerator Interfaces</h2>

        <ul>

            <li>IEnumerable: supports simple iteration over a collection.</li>

            <li>IEnumerator: supports enumerating through a collection (MoveNext, Current, Reset).</li>

            <li>Used for foreach loops.</li>

        </ul>

    </div>

    <div class="section">

        <h2>LINQ Queries on Collections</h2>

        <ul>

            <li>Language Integrated Query to filter, project, and aggregate data.</li>

            <li>Supports query syntax and method syntax.</li>

            <li>Works on any IEnumerable or IQueryable.</li>

        </ul>

    </div>

    <div class="section">

        <h2>ReadOnlyCollections</h2>

        <ul>

            <li>Wrappers around collections that prevent modification.</li>

            <li>Provide safe, immutable views of data.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Threading Basics (Thread class, ThreadPool)</h2>

        <ul>

            <li>Thread: manual thread creation and management.</li>

            <li>ThreadPool: managed pool of threads for background tasks, more efficient than creating threads manually.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Task Parallel Library (TPL)</h2>

        <ul>

            <li>Abstraction for parallel and asynchronous programming.</li>

            <li>Uses Task objects for managing concurrent operations.</li>

            <li>Simplifies thread management and synchronization.</li>

        </ul>

    </div>

    <div class="section">

        <h2>async/await for Asynchronous Programming</h2>

        <ul>

            <li>Keywords to write asynchronous code that looks synchronous.</li>

            <li>Improves UI responsiveness and scalability.</li>

            <li>Works with Task and Task&lt;T&gt;.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Cancellation Tokens</h2>

        <ul>

            <li>Cooperative cancellation of async or long-running operations.</li>

            <li>Passed to methods to signal cancellation requests.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Locks, Mutex, Monitor for Synchronization</h2>

        <ul>

            <li>Tools to prevent race conditions and ensure thread safety.</li>

            <li>lock statement uses Monitor internally.</li>

            <li>Mutex allows cross-process synchronization.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Init-only Setters</h2>

        <ul>

            <li>Properties that can only be set during object initialization.</li>

            <li>Allow immutable object initialization with flexible syntax.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Top-level Statements</h2>

        <ul>

            <li>Simplify program entry point by removing explicit Main method.</li>

            <li>Useful for small programs and scripts.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Pattern Matching Enhancements</h2>

        <ul>

            <li>More expressive and concise type checks and value matching.</li>

            <li>Support complex conditions directly in switch expressions.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Source Generators</h2>

        <ul>

            <li>Compile-time code generation feature.</li>

            <li>Helps reduce boilerplate and improve performance.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Nullable Reference Types</h2>

        <ul>

            <li>Compiler feature to distinguish nullable vs non-nullable references.</li>

            <li>Helps avoid null reference exceptions by enforcing annotations.</li>

        </ul>

    </div>

<div class="section">

        <h2>List</h2>

        <ul>

            <li>Dynamic array-based collection.</li>

            <li>Allows duplicate elements.</li>

            <li>Maintains insertion order.</li>

            <li>Provides fast indexed access (constant time).</li>

            <li>Automatically resizes as elements are added.</li>

            <li>Commonly used when order matters and frequent access by index is required.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Dictionary&lt;TKey, TValue&gt;</h2>

        <ul>

            <li>Collection of unique keys mapped to values.</li>

            <li>Keys must be unique; values can repeat.</li>

            <li>Provides fast lookup, insertion, and removal by key.</li>

            <li>Average lookup time is constant.</li>

            <li>Useful for key-value pair storage and retrieval scenarios.</li>

        </ul>

    </div>

    <div class="section">

        <h2>HashSet</h2>

        <ul>

            <li>Collection of unique elements, no duplicates allowed.</li>

            <li>Unordered collection (no guaranteed order).</li>

            <li>Provides fast addition, removal, and lookup.</li>

            <li>Supports set operations like union, intersection, and difference.</li>

            <li>Ideal for membership tests and when uniqueness is important.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Queue</h2>

        <ul>

            <li>First-In-First-Out (FIFO) collection.</li>

            <li>Enqueue adds an element to the end.</li>

            <li>Dequeue removes the element from the front.</li>

            <li>Suitable for scenarios like task scheduling or breadth-first search.</li>

            <li>Maintains order of processing based on insertion time.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Stack</h2>

        <ul>

            <li>Last-In-First-Out (LIFO) collection.</li>

            <li>Push adds an element on top.</li>

            <li>Pop removes the element from the top.</li>

            <li>Useful for undo operations, recursive algorithms, and backtracking.</li>

            <li>Processes elements in reverse order of insertion.</li>

        </ul>

    </div>

    <div class="section">

        <h2>Types of Constructors in C#</h2>

        <ul>

            <li>Default Constructor</li>

            <li>Parameterized Constructor</li>

            <li>Copy Constructor</li>

            <li>Static Constructor</li>

            <li>Private Constructor</li>

            <li>Constructor Overloading</li>

            <li>Chained Constructor (this)</li>

            <li>Base Constructor (base)</li>

            <li>Constructor with Optional Parameters</li>

        </ul>

    </div>

    <div class="section">

        <h2>Types of Inheritance in C#</h2>

        <ul>

            <li>Single Inheritance</li>

            <li>Multilevel Inheritance</li>

            <li>Hierarchical Inheritance</li>

            <li>Hybrid Inheritance (via interfaces)</li>

            <li>Interface Inheritance</li>

            <li>Multiple Inheritance (only via interfaces)</li>

        </ul>

    </div>


Comments

Popular posts from this blog

Krishna – The Divine Trickster, Friend, and Eternal Guide

🕉️ Shirdi Sai Baba’s Arrival in Shirdi at the Age of 16

Shirdi Sai Baba Leelas – Baba’s Divine Protection