static class MyExtensionMethods
{
public static int Negate(this int value)
{
return -value;
}
public static int Multiply(this int value, int multiplier)
{
return value * multiplier;
}
}
static void Main(string[] args)
{
// Passing arguments in extension methods
int i3 = 10;
Console.WriteLine(i3.Multiply(2));
}
Blog that contains articles about new technologies related or not with programming. I will describe and solves some problems that I encounter in my career. ASP .NET, AJAX, Javascript, C++, C# and SQL are some of the subjects that will appear.
16 March 2016
Extending using Extension methods
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment