Welcome, Guest Ohm namah shivoy
www.faqpanel.com
Home | ASP.Net | C-Sharp | Winforms | MS SQL | AJAX | XML | .Net Training*** | Search
Invite friends 
Extras 
VS Tips & Tricks
Top 10 .Net Tools
Special folders in ASP.Net
VS Find Combobox
 C-Sharp Interview Questions and Answers / FAQs
What is maximum dimension technically posible in C#?
60
In C#, for String class Equals means value equality or reference equality?
The default implementation of Equals supports reference equality only, but derived classes can override this method to support value equality.

Reference equality occurs when two reference type objects refer to the same object. Sometimes reference types need to define value equality instead of reference equality. Fortunately, the Equals method is virtual, so derived reference types may override it.

How to loop through a list of files in a directory?
This looks at all files ending in ".cs"

using System;
using System.IO;

public class Temp
{
public static void Main(string[] args) {
DirectoryInfo di = new DirectoryInfo(".");
foreach(FileInfo fi in di.GetFiles("*.cs")) {
Console.WriteLine("Looking at file \""+fi.FullName+"\""); }
}
}

Can I use inline assembly or IL in C# code?
No.
How do I create an instance of a type if I only know its name?
This is a two stage process. Firstly, you need to get a Type reference for the type. If the type you want to create an instance of is in either mscorlib or the current assembly, you can just use Type.GetType(name). If it is in a different assemby, you could either call Type.GetType and pass in the full type name including assembly information, or you could find or load the assemnbly and then call Assembly.GetType(name) on that assembly reference.

Once you have got a Type reference, you can either use Activator.CreateInstance(type) to create an instance, or call Type.GetConstructor to get a specific constructor which you can then use to create an instance by calling Invoke on it.

Displaying page 1 of 5NextLast
What are the characteristics of C#?
Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
What is the difference between the Debug class and Trace class?
Are C# constructors inherited
What is the "is" operator?
Why does C# compiler caught the use of = in place of == in if statement?
How do I get application full path & .exe?
How destructors works in C# ?
What is Delegate in C# ?
How do I use an alias for a namespace or class in C#?