Esempio n. 1
0
 static void Main(string[] args)
 {
     //You must use using blocks for use the memory as eficient.
     //Don't worry CaculatorWrapper class is CLI object. That's why, it has a Disposable pattern.
     //You don't need wrapping and implement dispose pattern for the CLI object.
     using (var wrapper = new CalculatorWrapper())
     {
         var sum = wrapper.Sum(10, 10); //10 + 10
         Console.WriteLine("Result: " + sum);
     }
     Console.Read();
 }
Esempio n. 2
0
    private void Start()
    {
        var t0 = canvas.transform.Find("text0").GetComponent <TextMeshProUGUI>();
        var t1 = canvas.transform.Find("text1").GetComponent <TextMeshProUGUI>();
        var t2 = canvas.transform.Find("text2").GetComponent <TextMeshProUGUI>();
        var t3 = canvas.transform.Find("text3").GetComponent <TextMeshProUGUI>();

        const int a = 10;
        const int b = 5;

        using (var c = new CalculatorWrapper(a, b))
        {
            t0.text = $"a = {a}, b = {b}";
            t1.text = $"{a} + {b} = {c.Sum()}";
            t2.text = $"{a} - {b} = {c.Sub()}";
            t3.text = $"{a}! = {c.Factorial()}";
        }
    }