Extension methods help you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method.
For example, let us assume Car.dll is the 3rd party DLL and source is not available.
Car Class Library - Details.CS
For example, let us assume Car.dll is the 3rd party DLL and source is not available.
Car Class Library - Details.CS
namespace Car
{
public class Details
{
public string Wheel(string cartype)
{
if (cartype=="CORROLA")
return "Two";
if (cartype == "JEEP")
return "Four";
else
return "No Wheel";
}
}
}
{
public class Details
{
public string Wheel(string cartype)
{
if (cartype=="CORROLA")
return "Two";
if (cartype == "JEEP")
return "Four";
else
return "No Wheel";
}
}
}