-
Interface in C#
If the interface in C# only contains the declaration of the methods and we need to define those methods in the class, then Why we use the interface..???
-
Print Sum of Digits
Write a function to print sum of the digits in a given integer n without converting it to String. For example : if n = 1234 the function should return 1+2+3+4 = 10 if n = 15 the function should return 1+5 =6 if n = 5 the function should return 5.
-
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...