Home
C-Sharp
Interview FAQs

Show

FAQs of level

1. Properties can validate data before allowing a change.
2. Properties can transparently expose data on a class where that data is actually retrieved from some other source such as a database.
3. Properties can take an action when data is changed, such as raising an event or changing the value of other fields.
The main difference between .dll and .exe is

.dll is the In process component where it take up the client's memory space to run. So the communication between the application and component(dll) is very fast.

.EXE is the Out of process component. It uses its own memory(not application memory) to run the component. The communication between the application and component is slow when compared to .dll
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
Exe is executable and independent program/process to run which has its own reserved memory space whereas DLL (Dynamic Link Library) is neither executable and not even independent, it used by other DLL/program.
GAC stands for Global Access Cache where shareable/public assemblies (DLL) stored to be used by multiple programs. It gives a shared platform for programs to use single assembly and can store same assembly (of same name) with different versions and can help to solve DLL HELL.
A delegate is a type safe function pointer. Using delegates you can pass methods as parameters. To pass a method as a parameter, to a delegate, the signature of the method must match the signature of the delegate. This is why, delegates are called type safe function pointers.

Delegates are mainly used to define call back methods. There are two basic uses of delegates:

  • Callbacks / events.
  • Method and function abstraction.

Generics are classes, structures, interfaces, and methods that have placeholders (type parameters) for one or more of the types that they store or use. A generic collection class might use a type parameter as a placeholder for the type of objects that it stores; the type parameters appear as the types of its fields and the parameter types of its methods. A generic method might use its type parameter as the type of its return value or as the type of one of its formal parameters

public class Generic

 {   public T Field;}


public static void Main()

{

    Generic g = new Generic();

    g.Field = "A string";

    Console.WriteLine("Generic.Field           = "{0}"", g.Field);

    Console.WriteLine("Generic.Field.GetType() = {0}", g.Field.GetType().FullName);

}

Generic classes encapsulate operations that are not specific to any particular data type. The most common use for generic classes is with the collections like linked lists, hash tables, stacks, queues, trees and so on where operations such as adding and removing items from the collection are performed in more or less the same way regardless of the type of the data being stored.

The advantage of generics is better type safety, code re-usability and better performance. Generics are most commonly used to create a collection

C# is an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework. You can use C# to create Windows client applications, XML Web services, distributed components, client-server applications, database applications, and much, much more. Visual C# provides an advanced code editor, convenient user interface designers, integrated debugger, and many other tools to make it easier to develop applications based on the C# language and the .NET Framework. Reference - http://msdn.microsoft.com/en-IN/library/z1zx9t92.aspx
No, Multiple catch blocks can not be executed. Once the proper catch block code executed, the control is transferred to the finally block if exists and then the code that follows the catch or finally block gets executed.
PreviousDisplaying 16 of 25Next
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*