-
C# Calender Days
How to find out how many calender days are there between two dates in c#.net?
-
Unsafe Keyword
Why we use pointer in C#.NET with Unsafe keyword?
-
YIELD Keyword
What is the purpose of YIELD Keyword in C#?
-
Singleton Class
Give an example of inbuilt Singleton Class in .NET.
-
Late and early binding
which one best in late binding and early binding? What is the difference between them ?
-
Properties in C#
What are properties in C#? What are the advantages of using Properties ?
-
Can we write Dotnet Console program in Unix
Can we write Dotnet Console program in Unix ? If yes Give one example.
-
Advantages of static class over class ?
When to use static class and when to use normal class ?
-
Why does DllImport not work for me?
All methods marked with the DllImport attribute must be marked as public static extern.
-
Is there a way to force garbage collection?
Yes. Set all references to null and then call System.GC.Collect().If you need to have some objects destructed, and System.GC.Collect() doesn't seem to be doing it for you, you can force finalizers to be run by setting all the references to the object to null and then calling System.GC.RunFinalizers().
-
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 o) { }
-
Does C# support properties of array types?
Yes. Here's a simple example: using System;class Class1 {private string[] MyField;public string[] MyProperty {get { return MyField; }set { MyField = value; }}}class MainClass{public static int Main(string[] args) {Class1 c = new Class1();string[] arr = new string[] {"apple", "banana;c.MyProperty = arr;Console.WriteLine(c.MyProperty[0]); // "apple"return 0;}}
-
Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.
-
What is a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
-
What is CLS?
Skill/Topic: BeginnerA) Common Language SpecificationB) Common Library SystemC) Csharp Language SpecificationD) Code Location Specification
-
What is CLR?
Skill/Topic: BeginnerA) Common Library ReorganizationB) Csharp Language RespecificationC) Csharp Library RosterD) Common Language Runtime
-
A local C# variable declared in the for loop is in scope in
Skill/Topic: BeginnerA) Body of the for loopB) The method which includes the for loopC) Class
-
What is true about readonly variable in C# code?
Skill/Topic: BeginnerA) It's the same as a constantB) It's value can be assigned only onceC) You can never assign a value to it
-
You can inherit multiple interfaces in C#
Skill/Topic: IntermediateA) TrueB) FalseExplanation: A class can inherit multiple interfaces
-
To change the value of a variable while debugging , the following window is used
Skill/Topic: IntermediateA) DebugB) WatchC) Immediate
C# Interview Questions
Ans