Start New Discussion within our Software Development Community

How do i slow down event,so the output would look like this?
inf0.jpg

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace Event1
{
    public delegate void DingDongHandler(string text);
    public class ClassWithEvent
    {
        public Timer DingdongTimer { get; private set; }
        public event DingDongHandler DingDong;
        public void Start()
        { //this code just uses the Timer object which will at some
            //point cause the method CheckTimer to be called
            DingdongTimer = new Timer(2000);
            DingdongTimer.Elapsed += CheckTimer;
            DingdongTimer.Start();
        }
        public void CheckTimer(object source, ElapsedEventArgs e)
        { //this raises the event DingDong
            DingDong("Dinnnng Donnnnnng"); ;
        }
    }
}




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Event1
{
    class Program
    {
        static void Main(string[] args)
        {
            var obj = new ClassWithEvent();
            //subscribe to the event
            obj.DingDong += MyEhMethod;
            //use the object which may raise an event
            obj.Start();
            Console.WriteLine( "Enter first number:"  );
            int first = int.Parse(Console.ReadLine( ));
            Console.WriteLine(  "Enter second number :" );
            int second = int.Parse(Console.ReadLine());
            int result = first + second;
            Console.WriteLine(  "Result is" +result );
            Console.Read();
        }
        static public void MyEhMethod(string text)
        {
            Console.WriteLine("Have received {0} ", text);
        }
    }
}

You mind providing a little more detail. For instance what exactly are you trying to accomplish? The image and code alone aren't really explaining the issue or the goal

This article has been dead for over six months. Start a new discussion instead.