<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Logaan's Site &#187; C#</title>
	<atom:link href="http://www.logaans-site.co.uk/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logaans-site.co.uk</link>
	<description>In my own little world, world...world</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:02:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Composite WPF Presentation Model item template</title>
		<link>http://www.logaans-site.co.uk/2010/01/06/composite-wpf-presentation-model-item-template/</link>
		<comments>http://www.logaans-site.co.uk/2010/01/06/composite-wpf-presentation-model-item-template/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:16:33 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Item Template]]></category>
		<category><![CDATA[VS2008]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=555</guid>
		<description><![CDATA[Neat little template I designed for use at work which is an improvement over the ViewModel code snippet. Download PresentationModel item template How to use It is a bit unusual the way I have written this. Instead of specifying the file name for the item, it is the view name that is to be used. [...]]]></description>
			<content:encoded><![CDATA[<p>Neat little template I designed for use at work which is an improvement over the ViewModel code snippet.</p>
<p><a href="http://www.logaans-site.co.uk/wp-content/uploads/2010/01/PresentationModel.zip">Download PresentationModel item template</a></p>
<p><strong>How to use</strong></p>
<p>It is a bit unusual the way I have written this. Instead of specifying the file name for the item, it is the view <em>name </em>that is to be used.</p>
<p>When prompted for the ViewName, specifying &#8220;MainWindow&#8221; will create:</p>
<p>A xaml user control called MainWindowView.xaml.</p>
<p>An interface called IMainWindowView.</p>
<p>An interface called IMainWindowViewModel.</p>
<p>A class called MainWindowViewModel.</p>
<p>(Some of this is very similar to the ViewModel code snippet)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2010/01/06/composite-wpf-presentation-model-item-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interface Properties</title>
		<link>http://www.logaans-site.co.uk/2009/11/25/interface-properties/</link>
		<comments>http://www.logaans-site.co.uk/2009/11/25/interface-properties/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 17:09:27 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=540</guid>
		<description><![CDATA[Basically rip-offs of the prop and propg code snippets you get with Visual Studio but without the scope or accessor keywords. iprop &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60;CodeSnippets xmlns=&#34;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#34;&#62; &#60;CodeSnippet Format=&#34;1.0.0&#34;&#62; &#60;Header&#62; &#60;Title&#62;iprop&#60;/Title&#62; &#60;Shortcut&#62;iprop&#60;/Shortcut&#62; &#60;Description&#62;Code snippet for an automatically implemented property on an interface&#60;/Description&#62; &#60;Author&#62;Alex Boyne-Aitken&#60;/Author&#62; &#60;SnippetTypes&#62; &#60;SnippetType&#62;Expansion&#60;/SnippetType&#62; &#60;/SnippetTypes&#62; &#60;/Header&#62; &#60;Snippet&#62; &#60;Declarations&#62; &#60;Literal&#62; &#60;ID&#62;type&#60;/ID&#62; &#60;ToolTip&#62;Property type&#60;/ToolTip&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Basically rip-offs of the <em>prop </em>and <em>propg </em>code snippets you get with Visual Studio but without the scope or accessor keywords.</p>
<p><strong>iprop</strong></p>
<pre class="brush: xml; auto-links: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;CodeSnippets  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
	&lt;CodeSnippet Format=&quot;1.0.0&quot;&gt;
		&lt;Header&gt;
			&lt;Title&gt;iprop&lt;/Title&gt;
			&lt;Shortcut&gt;iprop&lt;/Shortcut&gt;
			&lt;Description&gt;Code snippet for an automatically implemented property on an interface&lt;/Description&gt;
			&lt;Author&gt;Alex Boyne-Aitken&lt;/Author&gt;
			&lt;SnippetTypes&gt;
				&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
			&lt;/SnippetTypes&gt;
		&lt;/Header&gt;
		&lt;Snippet&gt;
			&lt;Declarations&gt;
				&lt;Literal&gt;
					&lt;ID&gt;type&lt;/ID&gt;
					&lt;ToolTip&gt;Property type&lt;/ToolTip&gt;
					&lt;Default&gt;int&lt;/Default&gt;
				&lt;/Literal&gt;
				&lt;Literal&gt;
					&lt;ID&gt;property&lt;/ID&gt;
					&lt;ToolTip&gt;Property name&lt;/ToolTip&gt;
					&lt;Default&gt;MyProperty&lt;/Default&gt;
				&lt;/Literal&gt;
			&lt;/Declarations&gt;
			&lt;Code Language=&quot;csharp&quot;&gt;&lt;![CDATA[$type$ $property$ { get; set; }$end$]]&gt;
			&lt;/Code&gt;
		&lt;/Snippet&gt;
	&lt;/CodeSnippet&gt;
&lt;/CodeSnippets&gt;
</pre>
<p><strong>ipropg</strong></p>
<pre class="brush: xml; auto-links: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;CodeSnippets  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
	&lt;CodeSnippet Format=&quot;1.0.0&quot;&gt;
		&lt;Header&gt;
			&lt;Title&gt;ipropg&lt;/Title&gt;
			&lt;Shortcut&gt;ipropg&lt;/Shortcut&gt;
			&lt;Description&gt;Code snippet for an automatically implemented property with a 'get' accessor for interfaces&lt;/Description&gt;
			&lt;Author&gt;Alex Boyne-Aitken&lt;/Author&gt;
			&lt;SnippetTypes&gt;
				&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
			&lt;/SnippetTypes&gt;
		&lt;/Header&gt;
		&lt;Snippet&gt;
			&lt;Declarations&gt;
				&lt;Literal&gt;
					&lt;ID&gt;type&lt;/ID&gt;
					&lt;ToolTip&gt;Property type&lt;/ToolTip&gt;
					&lt;Default&gt;int&lt;/Default&gt;
				&lt;/Literal&gt;
				&lt;Literal&gt;
					&lt;ID&gt;property&lt;/ID&gt;
					&lt;ToolTip&gt;Property name&lt;/ToolTip&gt;
					&lt;Default&gt;MyProperty&lt;/Default&gt;
				&lt;/Literal&gt;
			&lt;/Declarations&gt;
			&lt;Code Language=&quot;csharp&quot;&gt;&lt;![CDATA[$type$ $property$ { get; }$end$]]&gt;
			&lt;/Code&gt;
		&lt;/Snippet&gt;
	&lt;/CodeSnippet&gt;
&lt;/CodeSnippets&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/11/25/interface-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View model property</title>
		<link>http://www.logaans-site.co.uk/2009/11/02/view-model-property/</link>
		<comments>http://www.logaans-site.co.uk/2009/11/02/view-model-property/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:07:04 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=508</guid>
		<description><![CDATA[Because I am so lazy :P &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60;CodeSnippets xmlns=&#34;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#34;&#62; &#60;CodeSnippet Format=&#34;1.0.0&#34;&#62; &#60;Header&#62; &#60;Title&#62;View model property snippet&#60;/Title&#62; &#60;Shortcut&#62;vmprop&#60;/Shortcut&#62; &#60;Description&#62;&#60;/Description&#62; &#60;Author&#62;Alex Boyne-Aitken&#60;/Author&#62; &#60;SnippetTypes&#62; &#60;SnippetType&#62;Expansion&#60;/SnippetType&#62; &#60;/SnippetTypes&#62; &#60;/Header&#62; &#60;Snippet&#62; &#60;Declarations&#62; &#60;Literal&#62; &#60;ID&#62;name&#60;/ID&#62; &#60;ToolTip&#62;Property name&#60;/ToolTip&#62; &#60;Default&#62;Field&#60;/Default&#62; &#60;/Literal&#62; &#60;Literal&#62; &#60;ID&#62;field&#60;/ID&#62; &#60;ToolTip&#62;Field name&#60;/ToolTip&#62; &#60;Default&#62;field&#60;/Default&#62; &#60;/Literal&#62; &#60;Literal&#62; &#60;ID&#62;type&#60;/ID&#62; &#60;ToolTip&#62;Type&#60;/ToolTip&#62; &#60;Default&#62;object&#60;/Default&#62; &#60;/Literal&#62; &#60;/Declarations&#62; &#60;Code Language=&#34;csharp&#34;&#62; &#60;![CDATA[ $type$ $field$; public $type$ $name$ [...]]]></description>
			<content:encoded><![CDATA[<p>Because I am so lazy :P</p>
<pre class="brush: xml; auto-links: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;CodeSnippets  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
	&lt;CodeSnippet Format=&quot;1.0.0&quot;&gt;
		&lt;Header&gt;
			&lt;Title&gt;View model property snippet&lt;/Title&gt;
			&lt;Shortcut&gt;vmprop&lt;/Shortcut&gt;
			&lt;Description&gt;&lt;/Description&gt;
			&lt;Author&gt;Alex Boyne-Aitken&lt;/Author&gt;
			&lt;SnippetTypes&gt;
				&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
			&lt;/SnippetTypes&gt;
		&lt;/Header&gt;
		&lt;Snippet&gt;
			&lt;Declarations&gt;
        &lt;Literal&gt;
          &lt;ID&gt;name&lt;/ID&gt;
          &lt;ToolTip&gt;Property name&lt;/ToolTip&gt;
          &lt;Default&gt;Field&lt;/Default&gt;
        &lt;/Literal&gt;
        &lt;Literal&gt;
          &lt;ID&gt;field&lt;/ID&gt;
          &lt;ToolTip&gt;Field name&lt;/ToolTip&gt;
          &lt;Default&gt;field&lt;/Default&gt;
        &lt;/Literal&gt;
        &lt;Literal&gt;
          &lt;ID&gt;type&lt;/ID&gt;
          &lt;ToolTip&gt;Type&lt;/ToolTip&gt;
          &lt;Default&gt;object&lt;/Default&gt;
        &lt;/Literal&gt;
			&lt;/Declarations&gt;
			&lt;Code Language=&quot;csharp&quot;&gt;
        &lt;![CDATA[
    $type$ $field$;
    public $type$ $name$
    {
        get { return $field$; }
        set
        {
            if ($field$ == value)
                return;

            $field$ = value;
            SendPropertyChanged(&quot;$name$&quot;);
        }
    }
			$end$]]&gt;
			&lt;/Code&gt;
		&lt;/Snippet&gt;
	&lt;/CodeSnippet&gt;
&lt;/CodeSnippets&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/11/02/view-model-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Closeable TabItems using CompositeWPF</title>
		<link>http://www.logaans-site.co.uk/2009/06/25/closeable-tabitems-using-compositewpf/</link>
		<comments>http://www.logaans-site.co.uk/2009/06/25/closeable-tabitems-using-compositewpf/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 11:53:32 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=455</guid>
		<description><![CDATA[On a project I am working on at the moment, I needed to allow the user to open and close views. As I was using the Composite Application Block injecting views into a tab control was really easy. Closing them was not. To remove a view from a region you need two things, the RegionName [...]]]></description>
			<content:encoded><![CDATA[<p>On a project I am working on at the moment, I needed to allow the user to open and close views.  As I was using the Composite Application Block injecting views into a tab control was really easy. Closing them was not.</p>
<p>To remove a view from a region you need two things, the RegionName and the View.</p>
<p>This article helped me a lot when engineering this approach:</p>
<p>http://blogs.infosupport.com/blogs/willemm/archive/2008/07/31/Creating-closeable-tabitems-for-use-in-CompositeWPF.aspx</p>
<p>However the RegionManager.GetRegionName did not work against the TabItem. I always got null, I am assuming this is a change that was made during the time the article was posted. Using the TabControl however worked.</p>
<p>But you cannot easily bind to two things (the TabControl and the TabItem).</p>
<p>To achieve my goal I used the XAML from the article and changed it little</p>
<pre class="brush: xml; auto-links: false;">
&lt;DataTemplate x:Key=&quot;CustomTabHeader&quot;&gt;
&lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
&lt;ContentPresenter&gt;
&lt;ContentPresenter.Content&gt;
&lt;Binding Path=&quot;Content.Model.HeaderText&quot;&gt;
&lt;Binding.RelativeSource&gt;
&lt;RelativeSource Mode=&quot;FindAncestor&quot;
AncestorType=&quot;{x:Type TabItem}&quot;/&gt;
&lt;/Binding.RelativeSource&gt;
&lt;/Binding&gt;
&lt;/ContentPresenter.Content&gt;
&lt;/ContentPresenter&gt;
&lt;Button Margin=&quot;8,0,0,0&quot;
Command=&quot;{Binding Path=Model.CloseTabCommand.Command, ElementName=ThisControl}&quot;
CommandParameter=&quot;{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type TabItem}}}&quot;
HorizontalContentAlignment=&quot;Center&quot;
VerticalContentAlignment=&quot;Center&quot;&gt;
&lt;Grid&gt;
&lt;Canvas Width=&quot;8&quot; Height=&quot;8&quot;&gt;
&lt;Line X1=&quot;2&quot; X2=&quot;6&quot; Y1=&quot;2&quot; Y2=&quot;6&quot; Stroke=&quot;Black&quot; StrokeThickness=&quot;1&quot;/&gt;
&lt;Line X1=&quot;6&quot; X2=&quot;2&quot; Y1=&quot;2&quot; Y2=&quot;6&quot; Stroke=&quot;Black&quot; StrokeThickness=&quot;1&quot;/&gt;
&lt;/Canvas&gt;
&lt;/Grid&gt;
&lt;/Button&gt;
&lt;/StackPanel&gt;
&lt;/DataTemplate&gt;

&lt;Style TargetType=&quot;TabItem&quot;&gt;
&lt;Style.Setters&gt;
&lt;Setter Property=&quot;HeaderTemplate&quot;
Value=&quot;{StaticResource CustomTabHeader}&quot;/&gt;
&lt;/Style.Setters&gt;
&lt;/Style&gt;
</pre>
<p>The only difference is where I go for my commands and header text. In my project I have an interface that describes a headed content item.</p>
<p>The change really is in the code for closing the view:</p>
<pre class="brush: csharp; auto-links: false;">
class CloseTabCommand : CommandModelBase
{
private readonly IRegionManager regionManager;

public CloseTabCommand(IRegionManager regionManager)
{
this.regionManager = regionManager;
}

public override void OnExecute(object sender, ExecutedRoutedEventArgs e)
{
var tabItem = (TabItem)e.Parameter;
var tabControl = (TabControl) e.Source;

var regionName = RegionManager.GetRegionName(tabControl);

regionManager.Regions[regionName].Remove(tabItem.Content);
}
}
</pre>
<p>In the end the solution boiled down to being really simple. You still bind to the tab item but the source is the tab control.</p>
<p>There will be some drawbacks to this approach. If a key binding is setup for this command then the source could change, so care should be taken.</p>
<p>But this works and it will do for the time being until I think of a better solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/06/25/closeable-tabitems-using-compositewpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generic WeakReference</title>
		<link>http://www.logaans-site.co.uk/2009/04/24/generic-weakreference/</link>
		<comments>http://www.logaans-site.co.uk/2009/04/24/generic-weakreference/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 21:48:42 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=433</guid>
		<description><![CDATA[I always felt that I wanted to use the WeakReference class a lot like the Nullable&#60;T&#62; class. internal class WrappedWeakReference&#60;T&#62; : WeakReference { public WrappedWeakReference(T target) : base(target) { } public new T Target { get { return (T) base.Target; } set { base.Target = value; } } public static implicit operator WrappedWeakReference&#60;T&#62;(T item) { [...]]]></description>
			<content:encoded><![CDATA[<p>I always felt that I wanted to use the WeakReference class a lot like the Nullable&lt;T&gt; class.</p>
<pre class="brush: csharp; auto-links: false;">

internal class WrappedWeakReference&lt;T&gt; : WeakReference
 {
 public WrappedWeakReference(T target)
 : base(target)
 {
 }

 public new T Target
 {
 get { return (T) base.Target; }
 set { base.Target = value; }
 }

 public static implicit operator WrappedWeakReference&lt;T&gt;(T item)
 {
 return new WrappedWeakReference&lt;T&gt;(item);
 }
 }
</pre>
<p>This allows you to write things like:</p>
<pre class="brush: csharp;">
 private WrappedWeakReference&lt;MyObject&gt; weakMyObject;

 public void Foo()
 {
 weakMyObject = new MyObject();
 }

 public void Bar()
 {
 weakMyObject.Target.SomeProperty....etc
 }
}
</pre>
<p>I think its nice idea.</p>
<p>However never did actually use this, I implemented the solution in a different manner where I did not need a weakreference, so this never got tested. I am not sure if it would work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/04/24/generic-weakreference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Empty object code snippet pattern</title>
		<link>http://www.logaans-site.co.uk/2009/04/12/empty-object-code-snippet-pattern/</link>
		<comments>http://www.logaans-site.co.uk/2009/04/12/empty-object-code-snippet-pattern/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 10:19:02 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=401</guid>
		<description><![CDATA[&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60;CodeSnippets xmlns=&#34;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#34;&#62; &#60;CodeSnippet Format=&#34;1.0.0&#34;&#62; &#60;Header&#62; &#60;Title&#62;Empty pattern snippet&#60;/Title&#62; &#60;Shortcut&#62;empty&#60;/Shortcut&#62; &#60;Description&#62;Creates an empty static property and nested null object &#60;/Description&#62; &#60;Author&#62;Alex Boyne-Aitken&#60;/Author&#62; &#60;SnippetTypes&#62; &#60;SnippetType&#62;Expansion&#60;/SnippetType&#62; &#60;/SnippetTypes&#62; &#60;/Header&#62; &#60;Snippet&#62; &#60;Declarations&#62; &#60;Literal&#62; &#60;ID&#62;type&#60;/ID&#62; &#60;ToolTip&#62;Class type&#60;/ToolTip&#62; &#60;Default&#62;Class&#60;/Default&#62; &#60;/Literal&#62; &#60;/Declarations&#62; &#60;Code Language=&#34;csharp&#34;&#62;&#60;![CDATA[ private static readonly $type$ empty = new NullObject(); public static $type$ Empty { get { [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml; auto-links: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;CodeSnippets  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
	&lt;CodeSnippet Format=&quot;1.0.0&quot;&gt;
		&lt;Header&gt;
			&lt;Title&gt;Empty pattern snippet&lt;/Title&gt;
			&lt;Shortcut&gt;empty&lt;/Shortcut&gt;
			&lt;Description&gt;Creates an empty static property and nested null object &lt;/Description&gt;
			&lt;Author&gt;Alex Boyne-Aitken&lt;/Author&gt;
			&lt;SnippetTypes&gt;
				&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
			&lt;/SnippetTypes&gt;
		&lt;/Header&gt;
		&lt;Snippet&gt;
			&lt;Declarations&gt;
				&lt;Literal&gt;
					&lt;ID&gt;type&lt;/ID&gt;
					&lt;ToolTip&gt;Class type&lt;/ToolTip&gt;
					&lt;Default&gt;Class&lt;/Default&gt;
				&lt;/Literal&gt;
			&lt;/Declarations&gt;
			&lt;Code Language=&quot;csharp&quot;&gt;&lt;![CDATA[
			private static readonly $type$ empty = new NullObject();
public static $type$ Empty { get { return empty; } }

private class NullObject : $type$
{
}
			$end$]]&gt;
			&lt;/Code&gt;
		&lt;/Snippet&gt;
	&lt;/CodeSnippet&gt;
&lt;/CodeSnippets&gt;
</pre>
<p><a href="http://www.logaans-site.co.uk/wp-content/uploads/2009/04/empty.snippet">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/04/12/empty-object-code-snippet-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View and ViewModel pattern code snippet</title>
		<link>http://www.logaans-site.co.uk/2009/04/12/view-and-viewmodel-pattern-code-snippet/</link>
		<comments>http://www.logaans-site.co.uk/2009/04/12/view-and-viewmodel-pattern-code-snippet/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 10:17:10 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippet]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=399</guid>
		<description><![CDATA[&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60;CodeSnippets xmlns=&#34;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#34;&#62; &#60;CodeSnippet Format=&#34;1.0.0&#34;&#62; &#60;Header&#62; &#60;Title&#62;ViewModel pattern snippet&#60;/Title&#62; &#60;Shortcut&#62;viewmodel&#60;/Shortcut&#62; &#60;Description&#62;Creates a view and viewmodel interface and a concreate view model &#60;/Description&#62; &#60;Author&#62;Alex Boyne-Aitken&#60;/Author&#62; &#60;SnippetTypes&#62; &#60;SnippetType&#62;Expansion&#60;/SnippetType&#62; &#60;/SnippetTypes&#62; &#60;/Header&#62; &#60;Snippet&#62; &#60;Declarations&#62; &#60;Literal&#62; &#60;ID&#62;name&#60;/ID&#62; &#60;ToolTip&#62;Base name&#60;/ToolTip&#62; &#60;Default&#62;Class&#60;/Default&#62; &#60;/Literal&#62; &#60;/Declarations&#62; &#60;Code Language=&#34;csharp&#34;&#62;&#60;![CDATA[ public interface I$name$View { I$name$ViewModel Model { get; set; } } public interface [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml; auto-links: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;CodeSnippets  xmlns=&quot;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&quot;&gt;
	&lt;CodeSnippet Format=&quot;1.0.0&quot;&gt;
		&lt;Header&gt;
			&lt;Title&gt;ViewModel pattern snippet&lt;/Title&gt;
			&lt;Shortcut&gt;viewmodel&lt;/Shortcut&gt;
			&lt;Description&gt;Creates a view and viewmodel interface and a concreate view model &lt;/Description&gt;
			&lt;Author&gt;Alex Boyne-Aitken&lt;/Author&gt;
			&lt;SnippetTypes&gt;
				&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;
			&lt;/SnippetTypes&gt;
		&lt;/Header&gt;
		&lt;Snippet&gt;
			&lt;Declarations&gt;
				&lt;Literal&gt;
					&lt;ID&gt;name&lt;/ID&gt;
					&lt;ToolTip&gt;Base name&lt;/ToolTip&gt;
					&lt;Default&gt;Class&lt;/Default&gt;
				&lt;/Literal&gt;
			&lt;/Declarations&gt;
			&lt;Code Language=&quot;csharp&quot;&gt;&lt;![CDATA[
    public interface I$name$View
    {
        I$name$ViewModel Model { get; set; }
    }

    public interface I$name$ViewModel
    {
        I$name$View View { get; }
    }

    class $name$ViewModel : I$name$ViewModel
    {
        private readonly I$name$View view;

        public $name$ViewModel(I$name$View view)
        {
            this.view = view;
            view.Model = this;
        }

        public I$name$View View
        {
            get { return view; }
        }
    }
			$end$]]&gt;
			&lt;/Code&gt;
		&lt;/Snippet&gt;
	&lt;/CodeSnippet&gt;
&lt;/CodeSnippets&gt;
</pre>
<p><a href="http://www.logaans-site.co.uk/wp-content/uploads/2009/04/viewmodel.snippet">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/04/12/view-and-viewmodel-pattern-code-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
