Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Extension Methods (edited)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; namespace Rextester { public static class Program { public static int Add(this int number, params int[] toAdd) { for (int i = 0; i < toAdd.Length; i++) number += toAdd[i]; return number; } public static int Multiply(this int number, params int[] toMultiply) { for (int i = 0; i < toMultiply.Length; i++) number *= toMultiply[i]; return number; } public static void Main(string[] args) { int number = 10; int sum = number.Add(5, 5, 5, 5); // 10 + 5 + 5 + 5 + 5 int product = sum.Multiply(10, 10); // 30 * 10 * 10 Console.WriteLine(sum); // Outputs 30 Console.WriteLine(product); // Outputs 3000 } } }
run
|
edit
|
history
|
help
0
Quadratic equation
dsdsdsdsd
фабрика статик
GYT
sdfghyjujyhtgrfedcf
Program.cs
sgshdfhdfhfdh
Jai
stack using LinkedList in C#
Lesson 1.2 Part II