Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TemporaryDirectory.cs « IO « System « UnitTestFramework « Tests « System.ComponentModel.Composition « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f373a292f54fbbb718e8f3a6dc7a531a6d9e6e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------

#if !SILVERLIGHT

using System;

namespace System.IO 
{
    public class TemporaryDirectory : IDisposable
    {
        private string _directoryPath;

        public TemporaryDirectory()
        {
            _directoryPath = FileIO.GetNewTemporaryDirectory();
        }

        public string DirectoryPath
        {
            get { return _directoryPath; }
        }
        
        public void Dispose()
        {
            if (_directoryPath != null)
            {
                try
                {
                    Directory.Delete(_directoryPath, true);
                }
                catch (IOException)
                {
                }

                _directoryPath = null;
            }
        }
    }
}

#endif