Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Composition
//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; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Installer { private readonly Logger _logger; public Installer(Logger logger) { _logger = logger; } public void Install() { _logger.Log("Installation Started"); _logger.Log("Installation Complitted"); } } public class DBmigrator { private readonly Logger _logger; public DBmigrator(Logger logger) { _logger = logger; } public void Migrate() { _logger.Log("We are migrating the database"); } } public class Calculator { private readonly SumCalculate _SumCalculate; public Calculator(SumCalculate sumCalculate) { _SumCalculate = sumCalculate; } public int Calcualte() { var result = _SumCalculate.Add(1, 2, 3, 4, 5); return result; } } public class SumCalculate { public int Add(params int [] numbers) { var sum = 0; foreach (var number in numbers) { sum += number; } return sum; } } public class Logger { public void Log(string message) { Console.WriteLine(message); } } public class Program { public static void Main(string[] args) { var dbMigrator = new DBmigrator(new Logger()); dbMigrator.Migrate(); var installer = new Installer(new Logger()); installer.Install(); var calculator = new Calculator(new SumCalculate()); var result = calculator.Calcualte(); Console.WriteLine(result); } } }
run
|
edit
|
history
|
help
0
practice program
Interface fully qualified names
binary search find minimum
Plt-D v.0.9.4
Classes, properties, methods, ling begining
sdfgjikjuyhtgrfed
Interesting dictionary initialization syntax
Social
amstrong number
FirstNonRepeatCharOfString