merge .FileFormats and .DataStructures
This commit is contained in:
28
OpenRa.FileFormats/DisposableAction.cs
Normal file
28
OpenRa.FileFormats/DisposableAction.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa
|
||||
{
|
||||
public class DisposableAction : IDisposable
|
||||
{
|
||||
public DisposableAction(Action a) { this.a = a; }
|
||||
|
||||
Action a;
|
||||
bool disposed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (disposed) return;
|
||||
disposed = true;
|
||||
a();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~DisposableAction()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user