web API

ASP.Net Web API is a powerful platform/framework for creating HTTP enabled service APIs (web services) that exposes data services to more clients including mobile devices, tablets, browsers and traditional desktop applications.

ASP.Net Web API uses all the features of HTTP like URIs, request/response headers, various content formats caching, versioning and there is no need to define any extra configuration settings for different devices like WCF rest services.

ASP.Net Web API communicate with HTTP/HTTPs

The basic CRUD operations are mapped to the HTTP protocols in the following manner:
GET: This will be used to retrieve the required data from the remote resource.
POST: This will create a new entry for the current data that is being sent to the server.
PUT: This will update the current representation of the data on the remote server.
DELETE: This will delete the specified data from the remote server.

Features of ASP.NET WEB API
-It can be hosted with in the applicaion or on IIS.
-It has automatic support for OData.
-It supports convention-based CRUD Actions

Basics of HTTP protocol

What is HTTP protocol?
HTTP stand for Hypertext transfer protocol.
It is application level protocol
It is client server protocol


Requests are sent by one entity like web browser and response is sent by another entity like web server.
Between this request and response there are numerous entities, collectively designated as proxies, which perform different operations and act as gateways or caches.
In reality, there are more computers between a browser and the server handling the request: there are routers, modems, and more.

How does HTTP protocol works?

HTTP uses the TCP transport protocol to make this connection. By default, web traffic uses TCP port 80

Basics of HTTP protocol:
It is simple – Human readable
It is extensible
It is stateless but not sessionless
It mostly uses TCP transport protocol

Difference between ref and out parameters

Difference between ref and out parameters

The ref keyword is used for passing parameter by reference
Need to be initialized before passing

The out paramter is used when method want to return multiple values
It is not mandatory to initialize paramter before passing

Ref and out in method overloading

Both ref and out cannot be used in method overloading simultaneously. However, ref and out are treated differently at run-time but they are treated same at compile time. Hence methods cannot be overloaded when one method takes a ref parameter and other method takes an out parameter. The following two methods are identical in terms of compilation.

class MyClass
public void Test(out int a) // compiler error “cannot define overloaded”
// method that differ only on ref and out”
public void Test(ref int a)
// method that differ only on ref and out”

However, method overloading can be done, if one method takes a ref or out argument and the other method takes simple argument. The following example is perfectly valid to be overloaded.

class MyClass
public void Test(int a)

public void Test(out int a)
// method differ in signature.