![]() Related Questions 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:// Latest Answer : c# switch allows fall through if and only if in empty case. as long as there is a statement in the case it must use break or go to to jump out of the case. ... Here's a quick example of the DllImport attribute in action: using System.Runtime.InteropServices;class C{[DllImport("user32.dll")]public static extern int MessageBoxA(int h, string m, string Latest Answer : ans:by using1st:using System.Runtime.InteropServicessecond step[DllImport("user32.dll")]use top of the class ... 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() Latest Answer : If you are not declare any Main() method in your program then compiler will give you this errors. Basically Main() is the entry point for compiler for execution. One more thing C# ia a case sensitive language so be carefull about the spelling of Main() ... Original Visual J++ code: public synchronized void Run() {// function body}Ported C# code: class C{public void Run(){lock(this){// function body }}public static void Main() {}} You want the lock statement, which is the same as Monitor Enter/Exit: lock(obj) {// code}translates to: try {CriticalSection.Enter(obj);// code} finally {CriticalSection.Exit(obj);} Latest Answer : A thread is simply a separate stream of execution that takes place simultaneously with and independently of everything else that might be happening. A thread can synchronize itself with another thread waiting for it to complete.The System.Threading.Thread ... Use the regasm.exe utility to generate a type library (if needed) and the necessary entries in the Windows Registry to make a class available to classic COM clients. Once a class is registered in the Windows Latest Answer : ans: using regasm.exe utility ... Casting the char to an int will give you the ASCII value: char c = 'f';System.Console.WriteLine((int)c);or for a character in a string: System.Console.WriteLine((int)s[3]);The base class libraries Latest Answer : Ans:// Create an ASCII encoding. Encoding ascii = Encoding.ASCII;The base class libraries also offer ways to do this with the Convert class or Encoding classes if you need a particular ... No. Latest Answer : Ans:Yes ... Yes. The code in the finally always runs. If you return out of the try block, or even if you do a "goto" out of the try, the finally block always runs, as shown in the following example: using Latest Answer : Ans:Yes ... The following is a response from a developer on the C# compiler team: We get rid of unused locals (i.e., locals that are never read, even if assigned).We get rid of unreachable code.We get rid of try-catch
Sponsored Links
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||