Dispose() public method

public Dispose ( ) : void
return void
Example #1
0
        static void Main(string[] args)
        {
            var configuration = BuildConfigurationRoot(args);
            var bus = CreateBus(configuration);
            var busHandle = bus.Start();

            var service = new SimulateVehicleDataService(bus, new RoutePlanner());
            StopOnCancelKeyPress(service);

            try
            {
                service.Start();
                _terminateApplication.WaitOne();
                service.Stop();
            }
            finally
            {
                service.Dispose();
                busHandle.Dispose();
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            var configuration = BuildConfigurationRoot(args);
            var bus           = CreateBus(configuration);
            var busHandle     = bus.Start();

            var service = new SimulateVehicleDataService(bus, new RoutePlanner());

            StopOnCancelKeyPress(service);

            try
            {
                service.Start();
                _terminateApplication.WaitOne();
                service.Stop();
            }
            finally
            {
                service.Dispose();
                busHandle.Dispose();
            }
        }