![]() |
| Home | Tech FAQ | Interview Questions | Placement Papers | Tech Articles | Learn | Freelance Projects | Online Testing | Geeks Talk | Job Postings | Knowledge Base | Site Search | Add/Ask Question |
![]() Related Questions The difference is that static read-only can be modified by the containing class, but const can never be modified and must be initialized to a compile time constant. To expand on the static read-only case Latest Answer : Constant : The constants are the one whose value remain same at all the time.it will be used if u want to define something at compile time.Read only....if you don't know value at compile time but u can find that at runtime that time u can use ... Use a conditional attribute on the method, as shown below: class Debug{[conditional("TRACE")]public void Trace(string s){Console.WriteLine(s);}}class MyClass{public static void Main(){Debug.Trace("hello");}}In Latest Answer : if you are using conditinoal attribute then add the name spaceSystem.Diagnostics.ConditionalAttribute ... C# has the is operator: expr is type Latest Answer : EX:==============using System; class ClassA {} public class TestIs{ public static void Test (object o) { ClassA a = null; if (o is ClassA) ... If you leave off the return type on a method declaration, the compiler thinks you are trying to declare a constructor. So if you are trying to declare a method that returns nothing, use void. The following Latest Answer : If your method does not have any return type then mention void before that method or return 0 ... C# requires only a single parameter for delegates: the method address. Unlike other languages, where the programmer must specify an object reference and the method to invoke, C# can infer both pieces of Latest Answer : This article is good.IntroductionIn this article I am going to share my knowledge on Delegates in C#.This would explain the Delegate using simple examples so that the beginner can understand the same.What is Delegate?Definition:Delegate is type which ... Make sure that the target type set in the project properties setting is set to Windows Application, and not Console Application. If you're using the command line, compile with /target:winexe & Latest Answer : Compile with following syntax at command line : csc /t:winexe ... No. C# does not have macros. Keep in mind that what some of the predefined C macros (for example, __LINE__ and __FILE__) give you can also be found in .NET classes like System.Diagnostics (for example, Latest Answer : Ans:No ... 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 ... No. However, there are plans for C# to support a type of template known as a generic. These generic types have similar syntax but are instantiated at run time as opposed to compile time. You can read more Latest Answer : Generics are a new feature in version 2.0 of the C# language and the common language runtime (CLR). Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification ... I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it? You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i;foo(out i);where foo is declared as follows: [return-type] foo(out int
Sponsored Links
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||