static void Main(string[] args) { Calculator <int> c = new Calculator <int>(); c.Add(5, 8); c.Multiply(5, 8); c.Subtract(5, 8); c.Mod(5, 8); Calculator <float> c2 = new Calculator <float>(); float result = c2.Add(5.6f, 4.3f); c2.Subtract(5.6f, 4.3f); Calculator <CustomNumber> c3 = new Calculator <CustomNumber>(); var num1 = new CustomNumber("Daniel"); var num2 = new CustomNumber("Mike"); CustomNumber num3 = c3.Add(num1, num2); c3.Multiply(num1, num2); c3.Subtract(num1, num2); c3.Mod(num1, num2); Console.ReadLine(); }
static void Main(string[] args) { var mikeCalc = new OneCalculatorToRuleThemAll <MikesNumbers>(); mikeCalc.Add(new MikesNumbers("Blah"), new MikesNumbers("Foo")); Console.ReadLine(); IntCalculator c = new IntCalculator(); c.Add(5, 8); c.Multiply(5, 8); c.Subtract(5, 8); c.Mod(5, 8); FloatCalculator c2 = new FloatCalculator(); float result = c2.Add(5.6f, 4.3f); c2.Subtract(5.6f, 4.3f); CustomNumberCalculator c3 = new CustomNumberCalculator(); var num1 = new CustomNumber("Daniel"); var num2 = new CustomNumber("Mike"); CustomNumber num3 = c3.Add(num1, num2); c3.Multiply(num1, num2); c3.Subtract(num1, num2); c3.Mod(num1, num2); Console.ReadLine(); }
public static dynamic GetTSObject(CustomNumber dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }