Paradox Game Engine
v1.0.0 beta06
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Events
Macros
Pages
AnonymousDisposable.cs
Go to the documentation of this file.
1
// Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2
// This file is distributed under GPL v3. See LICENSE.md for details.
3
using
System
;
4
5
namespace
SiliconStudio.Core
6
{
7
/// <summary>
8
/// This class allows implementation of <see cref="IDisposable"/> using anonymous functions.
9
/// The anonymous function will be invoked only on the first call to the <see cref="Dispose"/> method.
10
/// </summary>
11
public
class
AnonymousDisposable
: IDisposable
12
{
13
private
bool
isDisposed;
14
private
Action onDispose;
15
16
/// <summary>
17
/// Initializes a new instance of the <see cref="AnonymousDisposable"/> class.
18
/// </summary>
19
/// <param name="onDispose">The anonymous function to invoke when this object is disposed.</param>
20
public
AnonymousDisposable
(Action onDispose)
21
{
22
if
(onDispose == null)
23
throw
new
ArgumentNullException(
"onDispose"
);
24
25
this.onDispose = onDispose;
26
}
27
28
/// <inheritdoc/>
29
public
void
Dispose
()
30
{
31
if
(isDisposed)
32
return
;
33
34
isDisposed =
true
;
35
36
onDispose();
37
onDispose = null;
38
}
39
}
40
}
SiliconStudio.Core.AnonymousDisposable.Dispose
void Dispose()
Definition:
AnonymousDisposable.cs:29
SiliconStudio.Shaders.Parser.System
A system file.
SiliconStudio.Core.AnonymousDisposable.AnonymousDisposable
AnonymousDisposable(Action onDispose)
Initializes a new instance of the AnonymousDisposable class.
Definition:
AnonymousDisposable.cs:20
SiliconStudio.Core.AnonymousDisposable
This class allows implementation of IDisposable using anonymous functions. The anonymous function wil...
Definition:
AnonymousDisposable.cs:11
sources
common
core
SiliconStudio.Core
AnonymousDisposable.cs
Generated on Sat Dec 20 2014 21:51:07 for Paradox Game Engine by
1.8.7