﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PractiseExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var myDelegate = new Delegates();

            myDelegate.theDelegate += ExampleMethod;

            //var value = 1;
            //Console.WriteLine("testing the delgate with " + value);
            //var result = myDelegate.theDelegate(value);
            //Console.WriteLine(result);
            //Console.ReadLine();

            MainAsync().Wait();

            //Console.WriteLine(ArrayUtils.GetTheLastX(4).Length);
            //Console.WriteLine(ArrayUtils.GetTheLastXLinq(4).Length);
            //foreach (var item in ArrayUtils.SortAndTakeTheLastX(3))
            //{
            //    Console.WriteLine(item);
            //}
            //Console.ReadLine();
            //foreach (var item in ArrayUtils.ReverseAndTakeTheLastX(3))
            //{
            //    Console.WriteLine(item);
            //}
            //Console.ReadLine();
            //foreach (var item in ArrayUtils.Join())
            //{
            //    Console.WriteLine(item);
            //}
            //Console.ReadLine();
            //foreach (var item in ArrayUtils.Except())
            //{
            //    Console.WriteLine(item);
            //}
            //Console.ReadLine();
            //Console.WriteLine(StringUtils.AppendIfMoreThanX("Hello you there", 7));
            //Console.WriteLine(StringUtils.AppendIfMoreThanX("Hello you there", 15));
            //Console.WriteLine(StringUtils.Reverse("Hello you there"));
            Console.ReadLine();
        }

        static async Task MainAsync()
        {
            var myDelegate = new Delegates();

            myDelegate.theDelegate += ExampleMethod;

            Console.WriteLine("testing the async with the delegate");
            var testAsync = new TestAsync();
            var result = await testAsync.TestTheAsync(myDelegate.theDelegate, 1);
            Console.WriteLine(result);
            Console.ReadLine();
        }

        private static int ExampleMethod(int value)
        {
            return value;
        }

    }
}
