コード例 #1
0
        public void Start()
        {
            int[]      array        = GenerateRandomArray(_size, _maxValue);
            List <int> selectedInts = SelectWithoutRemainder(array, _div, _lim);

            int[] sortedArray = SortDescending(array);
            if (selectedInts.Count > 15)
            {
                var args = new GreaterThan15EventArgs();
                args.X = SelectGreaterThanLimit(array, _lim);
                args.Y = _lim;
                OnGreaterThan15(args);
            }
            else if (selectedInts.Count < 15)
            {
                Console.Write("The following array elements were not selected: ");
                foreach (int i in sortedArray)
                {
                    if (!selectedInts.Contains(i))
                    {
                        Console.Write(i + "   ");
                    }
                }
                Console.WriteLine(string.Empty);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: vleveris/psi-tasks
 private static void Greater(object sender, GreaterThan15EventArgs info)
 {
     Console.WriteLine("Event fired");
     Console.WriteLine("There are " + info.X + " integers greater than " + info.Y);
 }
コード例 #3
0
 protected virtual void OnGreaterThan15(GreaterThan15EventArgs e)
 {
     GreaterThan15.Invoke(this, e);
 }