-
Value of x
This is interview question,public void A() { int x; x = 8; x *= 4 + 8 / 2; } Given the above code, what is the value of "x"?options:- A) 3 B) 2 C)4 D) None
-
-
How do destructors and garbage collection work in C#?
C# has finalizers (similar to destructors except that the runtime doesn't guarantee they'll be called), and they are specified as follows: class C{~C(){// your code}public static void Main() {}}Currently, they override object.Finalize(), which is called during the GC process.
-
My switch statement works differently! Why?
C# does not support an explicit fall through for case blocks. The following code is not legal and will not compile in C#: switch(x){case 0:// do somethingcase 1:// do something in common with 0default:// do something in common with//0, 1 and everything elsebreak;}To achieve the same effect in C#, the code must be modified as shown below (notice how the control flows are explicit): class Test{public...