Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void
        public void DisposableActionGetsCorrectParameterFromCtor() {
            const int expected = 4543;

            TestTool
                .RunTasks(5,
                          () => {
                              int actual = 0;

                              // Disposing 되었을 때, actual 값이 변경됩니다.
                              var action = new DisposableAction<int>(delegate(int i) { actual = i; }, expected);

                              Assert.AreNotEqual(expected, actual);

                              action.Dispose();

                              Assert.AreEqual(expected, actual);
                          });
        }
示例#2
0
        public void DisposableActionGetsCorrectParameterFromCtor()
        {
            const int expected = 4543;

            TestTool
            .RunTasks(5,
                      () => {
                int actual = 0;

                // Disposing 되었을 때, actual 값이 변경됩니다.
                var action = new DisposableAction <int>(delegate(int i) { actual = i; }, expected);

                Assert.AreNotEqual(expected, actual);

                action.Dispose();

                Assert.AreEqual(expected, actual);
            });
        }