Interview Tips Interview Tips, Interview Questions and Answers

19Sep/100

Dynamic in C#4.0

The dynamic keyword is a key feature of this release. It closes the gap between dynamic and statically-typed languages. Now you can create dynamic objects and let their types be determined at run time. With the addition of the System.Dynamic namespace, you can create expandable objects and advanced class wrappers, and you can provide interoperability between different languages, including dynamic ones. Here is one quick example:
dynamic contact = new ExpandoObject();
contact.Name = "Jack CSharp";
contact.Phone = "123-456-7890";

29Dec/090

C# interview questions

    1. What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
    2. Can you store multiple data types in System.Array? No.
    3. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
    4. How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
    5. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
    6. What’s the difference between System.String and System.StringBuilder classes? System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
    7. What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
    8. What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.

More: http://tipsinterview.com/doc/Csharp_Interview_Questions.doc