Created
August 24, 2012 18:18
-
-
Save Sebazzz/3453874 to your computer and use it in GitHub Desktop.
Disposable Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/@KeyIndexDefined">True</s:Boolean> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Shortcut/@EntryValue">DisposablePattern</s:String> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Description/@EntryValue">Skeleton implementation for Disposable pattern</s:String> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Text/@EntryValue">private bool disposed;
 | |

 | |
/// <summary>
 | |
/// Releases unmanaged resources and performs other cleanup operations before the
 | |
/// <see cref="$ClassName$"/> is reclaimed by garbage collection.
 | |
/// </summary>
 | |
~$ClassName$() {
 | |
this.Dispose(false);
 | |
}
 | |

 | |
/// <summary>
 | |
/// Releases unmanaged and - optionally - managed resources
 | |
/// </summary>
 | |
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 | |
protected virtual void Dispose(bool disposing) {
 | |
if (!disposed) {
 | |
if (disposing) {
 | |
// TODO: release managed resources
 | |
}
 | |

 | |
// TODO: release unmanaged resources
 | |

 | |
this.disposed = true;
 | |
}
 | |
}
 | |

 | |
/// <summary>
 | |
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 | |
/// </summary>
 | |
public void Dispose() {
 | |
this.Dispose(true);
 | |

 | |
GC.SuppressFinalize(this);
 | |
}</s:String> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Reformat/@EntryValue">True</s:Boolean> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/ShortenQualifiedReferences/@EntryValue">True</s:Boolean> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Applicability/=Live/@EntryIndexedValue">True</s:Boolean> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Scope/=B68999B9D6B43E47A02B22C12A54C3CC/@KeyIndexDefined">True</s:Boolean> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Scope/=B68999B9D6B43E47A02B22C12A54C3CC/Type/@EntryValue">InCSharpTypeMember</s:String> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Scope/=B68999B9D6B43E47A02B22C12A54C3CC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String> | |
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Field/=ClassName/@KeyIndexDefined">True</s:Boolean> | |
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Field/=ClassName/Expression/@EntryValue">typeName()</s:String> | |
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Field/=ClassName/InitialRange/@EntryValue">-1</s:Int64> | |
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=8E61C859EB76F74A941E057B7CA12454/Field/=ClassName/Order/@EntryValue">0</s:Int64></wpf:ResourceDictionary> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment