Exemple #1
0
        private void btnCompute_Click(object sender, RoutedEventArgs e)
        {
            ulong arg = ulong.Parse(txtArg.Text);

            lblStatus.Content = "Calculating...";
            pC.BeginInvoke(arg, FactorialCompleted, null);
        }
        static void Main(string[] args)
        {
            Action <int, int>       action    = New;
            Func <int, int, string> func      = Populate;
            Predicate <int>         predicate = Compare;
            //Creates a new PerformCalculation type
            PerformCalculation performCalculation = new PerformCalculation(Add);
            PerformCalculation perform            = Add;

            perform += Multiply;

            //add method to feedback to user
            //add methods to store data in database, send Mail
            performCalculation(40, 45);
            performCalculation.Invoke(40, 45);
            perform.BeginInvoke(40, 45, null, null);
            //feedback to the user synchronously
            // store data in database, send Mail  runs asynchronously on another thread
            int sam = perform.EndInvoke(null);
        }