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";

2May/100

Explain the concepts of CTS and CLS(Common Language Specification).

CTS

When different languages are integrated and want to communicate, it is certain that the languages have their own data types and different declaration styles. CTS define how these different variables are declared and used in run time. E.g. VB offers an Integer data type while C++ offers long data type. Using CTS, these data types are converted to System32 which itself a data type of CLS.

CLS

Any language(s) that intend to use the Common Language Infrastructure needs to communicate with other CLS-Compliant language. This communication is based on set of rules laid by CLS. These rules define a subset of CTS.

16Apr/100

.NET interview: What is a CLR (Common Language Runtime)?

Often there is a need for different languages to communicate with each other at run time. For e.g. A class may be written in one language and its derived class may be written in a different language. Common Language Runtime is a run time environment for .NET. These different languages are integrated and can communicate easily because language compilers and tools that target the runtime use a common type system defined by the runtime.

Features or Functionalities offered by CLR:-

  • Garbage collection for managing life of objects.
  • Enables Cross language inheritance as explained in example above.
  • Syntax and keywords similar to C and C++