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?
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)
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.
After watching this video i am happy 😊
Can i have the video link of how to implement dependency injection in controller
I am also looking for it, Did you get it sir ?
Sir please make a detailed video on TYPES OF DEPENDENCY INJECTION
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
Soon I will add some more interview questions.
Awesome Explanation Sir
Happy bhai iski next video kahan hai
Sorry to say but in all your videos, you are leaving the people in question mode. Try to complete things in a single video.
sure
Could you please give the Detailed explanation of dependency injection concept in C# with examples in real-time senarios.
I guess instead of DI I could use public static methods. Why wouldn't I do that instead of DI?
Static methods are difficult to test and mock , that's why its avoided.
How to block multiple login with same credentials in different browsers and in different devices
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.
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?
Yes we have change. We have some limitations in this loosely coupled way.
I can't find the next video anywhere. could somebody please share ?
Can i have the video link of how to implement DI in controller
I am also looking for it, Did you get it sir?
Int num1 = 20; int num2 = 30;
num1 ^= num2 ^= num1 ^= num2;
Console.Writeline(num1 + " , " + num2);
Ans : 0,20.. kindly explain this code sir..
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."
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.
sir it cover only 50% of the solution..