コード例 #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();
            }
        }