What is IOC Container

IOC Container is a mechanism to achieve dependency injection to make our classes loosely coupled.

We can achieve inversion of control using 2 ways-
1. Dependency injection pattern
2. Service Locator pattern

There are many IOC Container available in .Net,some of mostly used are as given below…

  1. Castle Windsor
  2. Ninject
  3. Autofac
  4. Unity

What is Rest

Rest(Representational State Transfer) is a architectural pattern to develop a api in restful manner

1- Follow rest suggested uri pattern e.g http://ABC.com/api/manage-employee http://ABC.com/api/manage-employee/1

2- Follow respective HttpVerb for each action.

e.g.

[HttpGet] //for retrieve data http://ABC.com/api/manage-employee

[HttpPut] // for update http://ABC.com/api/manage-employee/1

3. It works over HTTP Protocol.

Use of out keyword in c#

The main use of out would be where your method needs to return more then one parameter.

See below example of TryParse Method

using System;

public class Example
{
public static void Main()
{
String[] values = { null, “160519”, “9432.0”, “16,667”,” -322 “, “+4302”, “(100);”, “01FA” };
foreach (var value in values)
{
int number;

bool success = Int32.TryParse(value, out number);
if (success)
{
Console.WriteLine(“Converted ‘{0}’ to {1}.”, value, number);
}
else
{
Console.WriteLine(“Attempted conversion of ‘{0}’ failed.”,
value ?? “<null>”);
}
}
}
}