What is solid principal in C#

S stands for SRP (Single responsibility principle)
A class should perform only task related to itsef not others.
e.g we have a employee class we have add,update,delete and fetchemployee method and on adding each employee we send a welcome mail.So we should not implement mail method in employee class.we should create a seperate class for mailing

O stands for OCP (Open closed principle)
A class should desighned in such a way if there is any change in a already develoved class should be closed for modification but open for extension.This is because if you change in a existing,well tested,fine running method, you will have to re-test all cases which was not needed

L stands for LSP (Liskov substitution principle)
This principal says parent should easily replace the child object. the derived classes should be perfectly substitutable for their base classes. If class D,E is derived from A then D or E should be substitutable for A.
for example We can achive LSP in a abstract method of abstract class by assighning child instance in parent object as below
A obj= new E():
A obj= new D():

I stands for ISP ( Interface segregation principle)
ISP says If we are inheriting any interface Clients should not be forced to implement interfaces they don’t use. Instead of one huge interface, many small interfaces are preferred based on groups of methods, each one serving one sub module.“

D stands for DIP ( Dependency inversion principle)
High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.”

e.g DI design pattern

What is method chaining in jquery

Method chaining in jquery is to apply multiple method in one go over an element. See below example..

var el=$(‘#mydiv’):

el.removeclass(‘oldclass’).addclass(‘class1’).CSS(‘color’:’red’);

In above example we removed a class then added another class and then applied a css. We didn’t applied seperately each method instead chained it.

What is delegate in C#

A delegate is a class that can hold a reference to a method.it can hold references only to methods that match its signature.A delegate is a callback. Delegates allow for flexibility and fine-grain control in event handling. A delegate acts as an event dispatcher for the class that raises the event by maintaining a list of registered event handlers for the event. By convention,event delegates in the .NET Framework have two parameters, the source that raised the event and the data for the event.

What is contenttype and datatype in Ajax request

$.ajax({
  type: "GET",
  url: "/api/employees/getemployee",
  data: {'id:'+Id},
datatype : "json",
contentType: " application/json",


success
: function(data){

$("#resultarea”).text(data);

},
error: function (){
}

In above sample request we have both content type and datatype . Content type means type of data you sending to service/method. Datatype means type of data you are getting back from service/method.

In above sample we are sending json data and getting Jason in response.