Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Code challenge: Integer Comparison - Overkill - Function Dictionary
//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 Program { public static void Main(string[] args) { int a, b; a = 5; b = 3; Func<int,int,string> compare = (num1, num2) => { return new Dictionary<Func<int,int,bool>, string> { { (x,y) => x == y, "-1" } , { (x,y) => y > x, bool.TrueString } , { (x,y) => x > y, bool.FalseString } }.Single(f => f.Key(num1,num2)) .Value; }; Console.WriteLine(compare(a,b)); } } }
run
|
edit
|
history
|
help
0
30272 Program Ex7_1 switch_int
pause a thread
.net Q4
Rotate array to the right of a given pivot
Ejercicio bucles
up casting down casting
online compiler
dict
X o X
Collection_ basic datastructure brushup