What does an assembly contain?
Types of assembly?
How to register an assembly in GAC?
How C# code is converted to IL?
Why do we need two memories (Stack & Heap) ? Continue reading
An abstract class is a special kind of class that has no implementation. It cannot be instantiated. Its implementation logic is provided by the classes that derive from it. It can have both abstract as well as non-abstract methods.
It is not compulsory to have only abstract methods in an abstract class. We can also have an abstract class with only non-abstract methods.
Why do we need an Abstract Class? Continue reading
Dependency property can be linked to another property such that a change in the value of one changes the other.
The purpose of dependency properties is to provide a way to compute the value of a property based on the value of other inputs. These other inputs might include system properties such as themes and user preference, just-in-time property determination mechanisms such as data binding and animations/storyboards, multiple-use templates such as resources and styles, or values known through parent-child relationships with other elements in the element tree.
CLR property vs Dependency property: Continue reading
Where to use?
When there are some sub tasks or series of subsystems.
In such cases we need to bother about all the subsystems or we can say we need to remember all the classes, methods and sequence of calling. So to avoid this situation, we can use Facade pattern which provides an interface to client code and hide all the subsystems.
Lets takes an example for facade design pattern. Suppose I need to turn off my Desktop. So the activities involve in this task is : 1. Save my Work and ShutDown Windows. 2. Turn off Monitor 3. Turn off UPS. So there are 3 subsystems and my program looks like: There are 3 different classes with their respective methods. Continue reading
Below lists the differences between them based on their properties :
||No base interface
||Derives from IEnumerable
|How does it work
||While querying data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data. Hence does more work and becomes slow.
||While querying data from database, IQueryable execute select query on server side with all filters. Hence does less work and becomes fast.
||LINQ to Object and LINQ to XML queries.
||LINQ to SQL queries.
||Supports using CreateQuery and Execute methods.
|Extension methods supported in IEnumerable takes functional objects.
||Extension methods supported in IEnumerable takes expression objects i.e. expression tree.
|When to use
||when querying data from in-memory collections like List, Array etc.
||when querying data from out-memory (like remote database, service) collections.
Creating a method in derived class with same signature as a method in base class is called as method overriding.
Same signature means methods must have same name, same number of arguments and same type of arguments.
Method overriding is possible only in derived classes, but not within the same class.
When derived class needs a method with same signature as in base class, but wants to execute different code than provided by base class then method overriding will be used.
To allow the derived class to override a method of the base class, C# provides two options,virtual methods and abstract methods.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract.
If a method is not overriding the derived method, it is hiding it in the Derived class. A hiding method has to be declared using the new keyword. Continue reading
XML stands for Extensible Markup Language.
XML is a language used to build other languages. Languages such as XAML, WSDL.
XML has a configurable schema, you define the tags and the attributes. Continue reading
Query to get nth Highest Salary
Select TOP 1 Salary as ‘N Highest Salary’ from
SELECT DISTINCT TOP N Salary from Employee ORDER BY Salary DESC
ORDER BY Salary ASC
Replace N with the number. Continue reading
The Dispatcher class is used to perform work on his attached thread. It has a queue of work items and it is in charge of executing the work items on the dispatcher thread. Continue reading