Friday, March 23, 2012

Tricky Interview Questions – SharePoint


Information Architect

This will most likely be someone working for a consultancy company who will be tasked with gathering requirements and defining the goals for the SharePoint deployment. Then following that, defining the architecture for the deployment. This will include a knowledge of areas such as capacity planning, taxonomy, security and governance.

A question to ask this person in interview to test their knowledge is:

Thursday, March 22, 2012

What is a Constructor in C#?


A constructor is a member function that has the same name as the class name and is invoked automatically when the class is instantiated. A constructor is used to provide initialization code that gets executed every time the class is instantiated.

Points to be noted on constructors:

  • Constructors cannot be "virtual".
  • They cannot be inherited.
  • Constructors are called in the order of inheritance.
  • If we don't write any constructor for a class, C# provides an implicit default constructor, i.e., a constructor with no argument.
  • Constructors cannot return any value.
  • Constructors can be overloaded.

The syntax for a constructor is as follows:

[modifier] name (parameters)
{
  // constructor body
}

Wednesday, March 21, 2012

Inheritance & Polymorphism

When you derive a class from a base class, the derived class will inherit all members of the base class except constructors, though whether the derived class would be able to access those members would depend upon the accessibility of those members in the base class. C# gives us polymorphism through inheritance. Inheritance-based polymorphism allows us to define methods in a base class and override them with derived class implementations. Thus if you have a base class object that might be holding one of several derived class objects, polymorphism when properly used allows you to call a method that will work differently according to the type of derived class the object belongs to.

Difference between WCF vs. Web Services (ASMX)

Categories WCF ASMX (Web Services)
Protocols Support
  1. HTTP
  2. TCP
  3. Name Pipes
  4. MSMQ
  5. Custom
  6. UDP
  1. HTTP
Hosting
  1. A WCF component can be hosted in any kind of environment in .NET 3.0, such as a console application, Windows application, or IIS.
  2. WCF services are known as 'services' as opposed to web services because you can host services without a web server.
  3. Self-hosting the services gives you the flexibility to use transports other than HTTP.
Can be hosted only with HttpRuntime on IIS

Tuesday, March 20, 2012

Garbage collection in .NET


.Net is the much hyped revolutionary technology gifted to the programmer's community by Microsoft. Many factors make it a must use for most developers. In this article we would like to discuss one of the primary advantages of .NET framework - the ease in memory and resource management.
Every program uses resources of one sort or another-memory buffers, network connections, database resources, and so on. In fact, in an object-oriented environment, every type identifies some resource available for a program's use. To use any of these resources, memory must be allocated to represent the type.

Monday, March 19, 2012

Caching

What is caching?
High-performance Web applications should be designed with caching in mind. Caching is the technique of storing frequently used items in memory so that they can be accessed more quickly. Caching is important to Web applications because each time a Web form is requested, the host server must process the Web form’s HTML and run Web form code to create a response. By caching the response, all that work is bypassed. Instead, the request is served from the reponse already stored in memory.
Caching an item incurs considerable overhead, so it’s important to choose the items to cache wisely. A Web form is a good candidate for caching if it is frequently used and does not contain data that frequently changes. By storing a Web form in memory, you are effectively freezing that form’s server-side content so that changes to that content do not appear until the cache is refreshed

Abstract class and Interface


Introduction
In this article along with the demo project I will discuss Interfaces versus Abstract classes. The concept of Abstract classes and Interfaces is a bit confusing for beginners of Object Oriented programming. Therefore, I am trying to discuss the theoretical aspects of both the concepts and compare their usage. And finally I will demonstrate how to use them with C#.

Background
An Abstract class without any implementation just looks like an Interface; however there are lot of differences than similarities between an Abstract class and an Interface. Let's explain both concepts and compare their similarities and differences.

What is an Abstract Class?
An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.