Skip to main content

Posts

Common .Net Interview Questions and Why are they asked?

There are many .Net Questions that every interviewer(in general) asks. Through this, I am starting a series of discussions where in I'll be discussing these questions and provide ample satisfactory answers to them. The intent here is to realise the importance of these questions and help the needy(those who are preparing for interviews) and also who believe in knowing the basics rather than just blindly implementing the .Net classes/Interfaces. Starting the First part of this series is All time Classic question #1 Question: What is the difference between Abstract Classes and Interface? The moment this question is asked the candidates generally start uttering the bookish definitions, some of them are . a) Access modifiers: Interfaces--Implicitly Public() , Classes can use use Access Modifiers. b) No implementation in Interfaces, Classes can have implementations as well. c)Abstract classes can't be instantiated . Some more experienced candidates might get into some further details...

UML 2.0 (Unified Modeling Language)

You must be wondering why is UML described in this blog (Advanced .Net concepts).Before you start feeling “IT’s time wastage”, let me re-assure you about its importance by restoring to a real life example. Although “Kites” (Indian movie released in 2010) was a blunder at the box-office , however it gives us an opportunity to fit the UML discussion in the story line(although it never had any story).  Let’s start by asking Why UML. The answer, the Hero of the movie did not understand Spanish and the lady didn’t know English (mess created), would have been avoided if both of them knew a common language (might be Hindi!!!).  Any software is a global product involving Architects, designers, developers/Coders (situation is same as described above) .To develop, the pre-requisite is “understanding” and UML shortens the cycle involved in understanding.  The UML is applicable to object-oriented problem solving.  Object oriented solutions begin with the construction of a model. A model is an ab...

UML 2.0 (Unified Modeling Language)

You must be wondering why is UML described in this blog (Advanced .Net concepts).Before you start feeling “IT’s time wastage”, let me re-assure you about its importance by restoring to a real life example. Although “Kites” (Indian movie released in 2010) was a blunder at the box-office , however it gives us an opportunity to fit the UML discussion in the story line(although it never had any story).  Let’s start by asking Why UML. The answer, the Hero of the movie did not understand Spanish and the lady didn’t know English (mess created), would have been avoided if both of them knew a common language (might be Hindi!!!).  Any software is a global product involving Architects, designers, developers/Coders (situation is same as described above) .To develop, the pre-requisite is “understanding” and UML shortens the cycle involved in understanding.  The UML is applicable to object-oriented problem solving.  Object oriented solution...

Covariance and Contravariance-General Discussion

If you have just started the exploration of .Net Framework 4.0, two terms namely Covariance and Contravariance might have been heard. The concept that these terms encapsulate are used by most developer almost daily, however there has never been any botheration about the terminologies. Now, what actually these terms mean and how are these going to affect us as a developer, if we dive in to the details. The simple answer is it’s always good to know your tools before actually using them. Enough philosophy, let’s get to the business. Starting the discussion let me reiterate that in addition to Covariance and Contravariance, there is another terminology, Invariance. I’ll by start here by diving into the details of Invariance and then proceed further. Invariance: Invariance can be better understood by considering the types in .Net.>net has basically two type, value-types and reference-types. Value types (int, double etc) are invariant i.e. the types can’t be interchanged either ...

ExpandoObject Class Part-I

ExpandoObject Class Today I’ll cover the basics of ExpandoObject, which is similar to “dynamic”(covered in last post). The major dfference in Dynamic and ExpandoObject class is the fact that using an instance of this class, members can be dynamically added and removed at run time.In addition it can be used to get abd set the values of dynamically added members. The class is a part of System.Dynamic namespace This class implements the following interfaces. IDynamicMetaObjectProvider IDictionary ICollection > IEnumerable > IEnumerable INotifyPropertyChanged Example: dynamic expcheck = new ExpandoObject(); expcheck.Test = " This is Pradeep's Test"; Response.Write(expcheck.Test); Response.Write(expcheck.Test.GetType()); In the example above, an object of ExpandoObject class is created and and property(“Test”) is added to the object at runtime. To verify the concept, I print out the values and the output shows the value of the proper...

C# 4.0 dynamic Objects-Part-I

 C# 4.0 dynamic Objects Revisiting the C# 4.0 article (see my earlier post), new features introduced in C# 4.o can be grouped under the following Dynamic binding Named and optional arguments Variance Today I’ll discuss the most interesting feature the “Dynamic Programming”. C# 4.0 introduces a new static type called dynamic (under using System.Dynamic namespace) Dynamic objects expose members such as properties and methods at run time rather than at compile time. At compile time the dynamic object is assumed (no static binding) to support any specified operation and it is only at runtime that the error will crop up if the concerned operation is not supported. The type dynamic can be considered as a special version of the object type . Any object can be implicitly converted to dynamic with type checking postponed until runtime. Conversely, expressions of type dynamic can be implicitly converted to object , or any other type, as long as there exists a conversion at runti...

DLR-Expando Object

ExpandoObject Class This class represents an object whose members can be dynamically added and removed at run time. This class implements the following intefaces IDynamicMetaObjectProvider IDictionary ICollection > IEnumerable > IEnumerable INotifyPropertyChanged (for details about these interfaces please go theough MSDN documentation) The ExpandoObject class enables developer to add and delete members of its instances at run time. This class is also used to set and get values of these members. It  supports dynamic binding, which enables developers to use standard syntax rather than  more complex complex syntax that are currently used. For example: consider an object _Pobj which has associated member named MyMember It can be invoked as _Pobj.MyMember rather than _Pobj .GetAttribute("MyMember"). The ExpandoObject class implements the standard Dynamic Language Runtime (DLR) interface IDynamicMetaObjectProvider, which enables to share instance...