@@ -1,43 +1,44 | |||
|
1 | <?xml version="1.0" encoding="utf-8"?> | |
|
1 | <?xml version="1.0" encoding="utf-8"?> | |
|
2 | 2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 | 3 | <PropertyGroup> |
|
4 | 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
5 | 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
6 | 6 | <ProductVersion>10.0.0</ProductVersion> |
|
7 | 7 | <SchemaVersion>2.0</SchemaVersion> |
|
8 | 8 | <ProjectGuid>{99B95D0D-9CF9-4F70-8ADF-F4D0AA5CB0D9}</ProjectGuid> |
|
9 | 9 | <OutputType>Library</OutputType> |
|
10 | 10 | <RootNamespace>Implab</RootNamespace> |
|
11 | 11 | <AssemblyName>Implab</AssemblyName> |
|
12 | 12 | </PropertyGroup> |
|
13 | 13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
14 | 14 | <DebugSymbols>true</DebugSymbols> |
|
15 | 15 | <DebugType>full</DebugType> |
|
16 | 16 | <Optimize>false</Optimize> |
|
17 | 17 | <OutputPath>bin\Debug</OutputPath> |
|
18 | 18 | <DefineConstants>DEBUG;</DefineConstants> |
|
19 | 19 | <ErrorReport>prompt</ErrorReport> |
|
20 | 20 | <WarningLevel>4</WarningLevel> |
|
21 | 21 | <ConsolePause>false</ConsolePause> |
|
22 | 22 | </PropertyGroup> |
|
23 | 23 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
24 | 24 | <DebugType>full</DebugType> |
|
25 | 25 | <Optimize>true</Optimize> |
|
26 | 26 | <OutputPath>bin\Release</OutputPath> |
|
27 | 27 | <ErrorReport>prompt</ErrorReport> |
|
28 | 28 | <WarningLevel>4</WarningLevel> |
|
29 | 29 | <ConsolePause>false</ConsolePause> |
|
30 | 30 | </PropertyGroup> |
|
31 | 31 | <ItemGroup> |
|
32 | 32 | <Reference Include="System" /> |
|
33 | 33 | </ItemGroup> |
|
34 | 34 | <ItemGroup> |
|
35 | 35 | <Compile Include="Properties\AssemblyInfo.cs" /> |
|
36 | 36 | <Compile Include="Promise.cs" /> |
|
37 | 37 | <Compile Include="AsyncPool.cs" /> |
|
38 | <Compile Include="Safe.cs" /> | |
|
38 | 39 | </ItemGroup> |
|
39 | 40 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
|
40 | 41 | <ItemGroup> |
|
41 | 42 | <Folder Include="Parallels\" /> |
|
42 | 43 | </ItemGroup> |
|
43 | 44 | </Project> No newline at end of file |
@@ -1,19 +1,20 | |||
|
1 | 1 | using System; |
|
2 | 2 | using System.Collections.Generic; |
|
3 | 3 | using System.Linq; |
|
4 | 4 | using System.Text; |
|
5 | 5 | |
|
6 | 6 | namespace Implab |
|
7 | 7 | { |
|
8 | 8 | public static class Safe |
|
9 | 9 | { |
|
10 |
public static void Dispose<T>(ref T obj) where T : |
|
|
10 | public static void Dispose<T>(ref T obj) where T : class | |
|
11 | 11 |
|
|
12 | if (obj != null) | |
|
12 | var disp = obj as IDisposable; | |
|
13 | if (disp != null) | |
|
13 | 14 | { |
|
14 |
|
|
|
15 | disp.Dispose(); | |
|
15 | 16 | obj = default(T); |
|
16 | 17 | } |
|
17 | 18 | } |
|
18 | 19 | } |
|
19 | 20 | } |
General Comments 0
You need to be logged in to leave comments.
Login now