Пример #1
0
        static void Main(string[] args)
        {
            Thread thread = new Thread(
                () =>
                    {
                        SnapinWrapper wrapper = new SnapinWrapper();
                        Thread.Sleep(Timeout.Infinite);
                    });
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            while (true)
            {
                ExpensiveResource r = new ExpensiveResource();
                r.Use();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Thread thread = new Thread(
                () =>
            {
                SnapinWrapper wrapper = new SnapinWrapper();
                Thread.Sleep(Timeout.Infinite);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            while (true)
            {
                ExpensiveResource r = new ExpensiveResource();
                r.Use();
            }
        }