Why to use Dependency Injection?

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 24

  • @rkumartiwari1496
    @rkumartiwari1496 Год назад +2

    After watching this video i am happy 😊

  • @sitaramthirumalasetty9205
    @sitaramthirumalasetty9205 2 года назад +4

    Can i have the video link of how to implement dependency injection in controller

    • @easy_cook_food
      @easy_cook_food 4 месяца назад

      I am also looking for it, Did you get it sir ?

  • @quranandsoul1375
    @quranandsoul1375 Год назад

    Sir please make a detailed video on TYPES OF DEPENDENCY INJECTION

  • @ScitechExplorerEnglish
    @ScitechExplorerEnglish 2 года назад +1

    Sir can you make a video on upcasting and downcasting of base - derived types in c#....and why there is need for upcasting and downcasting

    • @interviewhappy
      @interviewhappy  2 года назад

      Soon I will add some more interview questions.

  • @nehalsingh785
    @nehalsingh785 4 месяца назад

    Awesome Explanation Sir

  • @theparagbagga
    @theparagbagga 11 месяцев назад

    Happy bhai iski next video kahan hai

  • @navalkish
    @navalkish 2 года назад +2

    Sorry to say but in all your videos, you are leaving the people in question mode. Try to complete things in a single video.

  • @theekshanmi3472
    @theekshanmi3472 Год назад

    Could you please give the Detailed explanation of dependency injection concept in C# with examples in real-time senarios.

  • @lgiorgos1
    @lgiorgos1 Год назад

    I guess instead of DI I could use public static methods. Why wouldn't I do that instead of DI?

    • @mahek2001
      @mahek2001 Год назад +1

      Static methods are difficult to test and mock , that's why its avoided.

  • @shardendumishra6229
    @shardendumishra6229 2 года назад +1

    How to block multiple login with same credentials in different browsers and in different devices

    • @interviewhappy
      @interviewhappy  2 года назад

      We can maintain some flag at server side, whether the user is active or not. Session is a traditional way but their can be other approaches.

  • @sourabhsalve8290
    @sourabhsalve8290 2 года назад +1

    Will u please explain - if we change method signature then do we need to change code in each and every controller? or for this type of change there is another solution. And in this type of situation how we can say it is loosely coupled?

    • @interviewhappy
      @interviewhappy  2 года назад

      Yes we have change. We have some limitations in this loosely coupled way.

  • @techwithchanchal
    @techwithchanchal Год назад

    I can't find the next video anywhere. could somebody please share ?

  • @jinupg6559
    @jinupg6559 6 месяцев назад

    Can i have the video link of how to implement DI in controller

    • @easy_cook_food
      @easy_cook_food 4 месяца назад

      I am also looking for it, Did you get it sir?

  • @karpagamm7169
    @karpagamm7169 Год назад

    Int num1 = 20; int num2 = 30;
    num1 ^= num2 ^= num1 ^= num2;
    Console.Writeline(num1 + " , " + num2);
    Ans : 0,20.. kindly explain this code sir..

    • @mayankpriyadarshi9346
      @mayankpriyadarshi9346 6 месяцев назад

      The code you've posted uses a series of bitwise XOR operations to swap the values of `num1` and `num2`. However, it looks like the result you mentioned, "0, 20," might be incorrect. The correct result of the swap operation using XOR should be "30, 20." Let's break down how it works:
      ### Initial Values:
      - `num1 = 20` (binary: `10100`)
      - `num2 = 30` (binary: `11110`)
      ### Operations:
      1. `num1 ^= num2`
      - `num1 = num1 ^ num2`
      - `num1 = 20 ^ 30`
      - `num1 = 10100 ^ 11110`
      - `num1 = 01010` (which is 10 in decimal)

      2. `num2 ^= num1`
      - `num2 = num2 ^ num1`
      - `num2 = 30 ^ 10`
      - `num2 = 11110 ^ 01010`
      - `num2 = 10100` (which is 20 in decimal)

      3. `num1 ^= num2`
      - `num1 = num1 ^ num2`
      - `num1 = 10 ^ 20`
      - `num1 = 01010 ^ 10100`
      - `num1 = 11110` (which is 30 in decimal)
      ### Final Values:
      - `num1 = 30`
      - `num2 = 20`
      ### Code:
      ```csharp
      int num1 = 20;
      int num2 = 30;
      num1 ^= num2; // Step 1: num1 becomes 10 (01010)
      num2 ^= num1; // Step 2: num2 becomes 20 (10100)
      num1 ^= num2; // Step 3: num1 becomes 30 (11110)
      Console.WriteLine(num1 + " , " + num2); // Output: 30 , 20
      ```
      ### Explanation:
      1. **First XOR (`num1 ^= num2`)**:
      - `num1 = num1 ^ num2` changes `num1` to `10` (binary `01010`).
      2. **Second XOR (`num2 ^= num1`)**:
      - `num2 = num2 ^ num1` changes `num2` to `20` (binary `10100`).
      3. **Third XOR (`num1 ^= num2`)**:
      - `num1 = num1 ^ num2` changes `num1` to `30` (binary `11110`).
      Thus, after the XOR swap sequence, `num1` becomes 30 and `num2` becomes 20, which is the intended result. If the output you see is "0, 20," there might be an error in the implementation or a different problem in the environment where the code is run. The correct output for this code should be "30, 20."

  • @ashishkumarsaini593
    @ashishkumarsaini593 5 месяцев назад

    Hi @Happy, please share full videos or else don't explain at all. Don't be commercial like others. Share information with good will and you'll get more than you expect.

  • @shrujankmr
    @shrujankmr Год назад

    sir it cover only 50% of the solution..