<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Paul van Brenk.com</title>
  <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/" />
  <link rel="self" href="http://feeds.feedburner.com/paulvanbrenk" />
  <icon>favicon.ico</icon>
  <updated>2012-04-20T19:35:59.6723062-07:00</updated>
  <author>
    <name>Paul van Brenk</name>
  </author>
  <subtitle>Standing on the shoulders of giants.</subtitle>
  <id>http://www.paulvanbrenk.com/blog/</id>
  <generator uri="http://dasblog.info/" version="2.3.12105.0">DasBlog</generator>
  <entry>
    <title>dasBlog 2.3.1 released</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2012/04/21/dasBlog231Released.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,1369be41-2972-40b0-9046-89dbaa2a58a8.aspx</id>
    <published>2012-04-20T19:34:57.0843038-07:00</published>
    <updated>2012-04-20T19:35:59.6723062-07:00</updated>
    <category term="dasBlog" label="dasBlog" scheme="http://www.paulvanbrenk.com/blog/CategoryView,category,dasBlog.aspx" />
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is our official 2.3.1 release.<br /><br />
Use source files if you are developing or pull the source from the "Source Code" tab
above.<br /><br /><br />
This is another small point release: 
<br /></p>
        <ul>
          <li>
.NET 3.5 support, 
</li>
          <li>
Better support for IE8/9 layout in themes, (minor) 
</li>
          <li>
Better support for XHTML 
</li>
          <li>
Supports the latest version of FreeTextBox (also better XHTML) 
</li>
          <li>
For developers, we now support VS 2010 
</li>
          <li>
Bug fix for error on comments as Admin reviewer and a comment had no Author element 
</li>
          <li>
Search Engine Optimization Patch added 
</li>
          <li>
New simple category less thread view, index of all blog posts 
</li>
          <li>
Google OpenID handling improvements 
</li>
          <li>
Upgraded to DotNetOpenAuth v3.4.5 
</li>
          <li>
We now officially support dasBlog on IIS 7 using integrated pipeline mode</li>
        </ul>
        <p>
          <a href="https://dasblog.codeplex.com/releases/view/86033">https://dasblog.codeplex.com/releases/view/86033</a>
        </p>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=1369be41-2972-40b0-9046-89dbaa2a58a8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The future of dasBlog</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2012/01/09/TheFutureOfDasBlog.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,e0d5173a-6e51-4619-bbd1-2d5959d83b6d.aspx</id>
    <published>2012-01-08T20:50:42.1594247-08:00</published>
    <updated>2012-01-08T20:55:21.0580125-08:00</updated>
    <category term="dasBlog" label="dasBlog" scheme="http://www.paulvanbrenk.com/blog/CategoryView,category,dasBlog.aspx" />
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The title is a lie (sort of)... I don't know what the long time future of dasBlog
is, but short term the following is going to happen. We will release a .NET 3.5 version
soon (which is running on this blog now). We probably will release a .NET 4 version
shortly following that. And when Visual Studio 11 is released in Beta, we will release
a version of dasBlog for .NET 4.5. 
</p>
        <p>
New features? DasBlog is fine for my needs as is, if you have something specific you
would like, please let us know. Depending on the complexity we might be able to put
it in.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=e0d5173a-6e51-4619-bbd1-2d5959d83b6d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Typeforwarding Generic Types</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2011/04/11/TypeforwardingGenericTypes.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,6bdd15fa-a325-4620-8031-a92dd1926fc4.aspx</id>
    <published>2011-04-11T15:41:37.0693426-07:00</published>
    <updated>2011-04-11T15:41:37.0693426-07:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <p>
When you forward a generic type to another assembly [0] using the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.typeforwardedtoattribute.aspx"> TypeForwardedTo
attribute</a>, you can’t specify the typeparameters. Instead the number of typeparameters
in in the class definition depends the number of comma’s in definition.
</p>
          <p>
          </p>
          <p>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">using</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"> System.Runtime.CompilerServices;</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">
            </span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">[</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">assembly</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">: </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">TypeForwardedTo</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">typeof</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(Destination.</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">SomeClass</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">))] </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;">//
Non generic</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">
            </span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">[</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">assembly</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">: </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">TypeForwardedTo</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">typeof</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(Destination.</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">SomeClass</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">&lt;&gt;))] </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;">//
equivalent to SomeClass&lt;T&gt;</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">
            </span>
          </p>
          <p>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">[</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">assembly</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">: </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">TypeForwardedTo</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue; background: white;">typeof</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">(Destination.</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF; background: white;">SomeClass</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;">&lt;,&gt;))] </span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;">//
equivalent to SomeClass&lt;T,U&gt;</span>
            <span style="font-size: 9.5pt; font-family: Consolas; color: green;">
            </span>
          </p>
          <p>
            <span style="font-size: 9.5pt; font-family: Consolas; color: green;">
            </span>
          </p>
          <p>
            <span class="MsoHyperlink">
              <a href="http://msdn.microsoft.com/en-us/library/ms404275.aspx">More
info on typeforwarding</a>
            </span>
          </p>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/typeforwarding-generic-types">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=6bdd15fa-a325-4620-8031-a92dd1926fc4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Visual Studio 2010 SP1 released!</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2011/03/08/VisualStudio2010SP1Released.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,2adcfa7e-b417-4f6a-a60a-8a97fe8bcfcc.aspx</id>
    <published>2011-03-08T15:33:05.444127-08:00</published>
    <updated>2011-03-08T15:33:05.444127-08:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <p>
As both <a href="http://blogs.msdn.com/b/jasonz/archive/2011/03/08/announcing-visual-studio-2010-service-pack-1.aspx"> Jason</a> and <a href="http://blogs.msdn.com/b/somasegar/archive/2011/03/07/visual-studio-2010-enhancements.aspx"> Soma</a> blogged
earlier, Visual Studio 2010 SP1 is released today. 
</p>
          <p>
          </p>
          <p>
MSDN subscriber can <a href="http://go.microsoft.com/fwlink/?LinkID=207267"> download
Service Pack 1</a> today, everyone else has to have a little more patience until March
10, when they can <a href="http://go.microsoft.com/fwlink/?LinkId=209902">download
it from Microsoft downloads</a>.
</p>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/visual-studio-2010-sp1-released">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=2adcfa7e-b417-4f6a-a60a-8a97fe8bcfcc" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Great features in Visual Basic</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2011/03/01/GreatFeaturesInVisualBasic.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,a6196cf4-4744-4488-8dce-91cde3da83b8.aspx</id>
    <published>2011-02-28T16:36:33.9487309-08:00</published>
    <updated>2011-02-28T16:36:33.9487309-08:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <p>
I’ve been doing a lot of development using Visual Basic in the past couple of
months and there are some interesting features in the language which may or may not
be very well known. Features that don’t have an equivalent in C#.
</p>
          <p>
          </p>
          <p>
            <b>Default values for auto implemented properties.</b>
          </p>
          <p>
          </p>
          <p>
Visual Basic support the option of setting a default value for a property, like you
would in a field.
</p>
          <p>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Public</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">
              <span style="color: blue;">Property</span> MyProp <span style="color: blue;">As</span><span style="color: blue;">Integer</span> =
42</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas;">
            </span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas;">
              <a href="http://msdn.microsoft.com/en-us/library/dd293589.aspx">MSDN:
Auto-Implemented Properties</a>
            </span>
          </p>
          <p>
          </p>
          <p>
            <b>Key properties in anonymous types</b>
          </p>
          <p>
            <b>
            </b>
          </p>
          <p>
By defining properties in anonymous types as key properties, you can enable specific
behavior for the equality behavior of these types. When an anonymous type contains
key properties, then for both the Equals and the GetHashCode overridde is generated
based on these key properties. Additionally the key properties are readonly, where
normal properties are read/write.
</p>
          <p>
            <b>
            </b>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Dim</span>
            <span style="font-size: 9.5pt; font-family: Consolas;"> one
= <span style="color: blue;">New</span><span style="color: blue;">With</span> {.Name
= <span style="color: #A31515;">"one"</span>, <span style="color: blue;">Key</span> .No
= 1}</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Dim</span>
            <span style="font-size: 9.5pt; font-family: Consolas;"> two
= <span style="color: blue;">New</span><span style="color: blue;">With</span> {.Name
= <span style="color: #A31515;">"two"</span>, <span style="color: blue;">Key</span> .No
= 1}</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas;">
            </span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: green;">' This is true
because the key property for both instances of the same class is equal</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">
            </span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas;">Assert.IsTrue(one.Equals(two))</span>
          </p>
          <p>
            <b>
            </b>
          </p>
          <p>
            <a href="http://msdn.microsoft.com/en-us/library/bb531349.aspx">MSDN: Key</a>
          </p>
          <p>
          </p>
          <p>
            <b>Filtered exceptions</b>
          </p>
          <p>
            <b>
            </b>
          </p>
          <p>
Adding a filter to a catch expression in a try/catch block allows you to direct the
exception handling based on a condition. This is especially useful when you’re
catching a general exception, which should be handled differently based on the error
code it contains.
</p>
          <p>
            <b>
            </b>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Try</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">
            </span>
          </p>
          <p style="text-indent: .5in;">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Throw</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">
              <span style="color: blue;">New</span>
              <span style="color: #2B91AF;">COMException</span>()</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Catch</span>
            <span style="font-size: 9.5pt; font-family: Consolas;"> ex <span style="color: blue;">As</span><span style="color: #2B91AF;">COMException</span><span style="color: blue;">When</span> ex.ErrorCode
= 0</span>
          </p>
          <p style="text-indent: .5in;">
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF;">Console</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">.WriteLine(<span style="color: #A31515;">"y
= 0"</span>)</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">Catch</span>
            <span style="font-size: 9.5pt; font-family: Consolas;"> ex <span style="color: blue;">As</span><span style="color: #2B91AF;">COMException</span><span style="color: blue;">When</span> ex.ErrorCode
&lt;&gt; 0</span>
          </p>
          <p style="text-indent: .5in;">
            <span style="font-size: 9.5pt; font-family: Consolas; color: #2B91AF;">Console</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">.WriteLine(<span style="color: #A31515;">"y
&lt;&gt; 0"</span>)</span>
          </p>
          <p style="">
            <span style="font-size: 9.5pt; font-family: Consolas; color: blue;">End</span>
            <span style="font-size: 9.5pt; font-family: Consolas;">
              <span style="color: blue;">Try</span>
            </span>
          </p>
          <p>
            <b>
            </b>
          </p>
          <p>
            <a href="http://msdn.microsoft.com/en-us/library/fk6t46tz.aspx">MSDN: Try...Catch...Finally
Statement</a>
          </p>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/great-features-in-visual-basic">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=a6196cf4-4744-4488-8dce-91cde3da83b8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Visual Studio 2010 sp 1 beta announced</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2010/12/07/VisualStudio2010Sp1BetaAnnounced.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,c90c6d1e-b2c0-45be-b730-6787422fec64.aspx</id>
    <published>2010-12-07T11:47:06.6336587-08:00</published>
    <updated>2010-12-07T11:47:06.6336587-08:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <p style="MARGIN: 0in 0in 0pt;">
Today <a href="http://blogs.msdn.com/b/jasonz/archive/2010/12/07/announcing-visual-studio-2010-service-pack-1-beta.aspx">Jason
Zander</a> announced the availability of <a href="http://go.microsoft.com/fwlink/?LinkId=207130">Visual
Studio 2010 SP1 Beta</a> on his blog. It’s available today for MSDN subscriber and
will be general available on Thursday.
</p>
          <p style="MARGIN: 0in 0in 0pt;">
          </p>
          <p style="MARGIN: 0in 0in 0pt;">
This service pack consists for the most part of fixes for issues logged through the
connect site, but one noticeable new feature is the inclusion of the VB runtime compiler
switch. This allows developers to ‘embed’ the Visual Basic Runtime in their assemblies,
similar to No-PIA. The compiler figures out which parts of the runtime your program
actually uses and embeds only these parts in the generated assemblies. 
</p>
          <p style="MARGIN: 0in 0in 0pt;">
          </p>
          <p style="MARGIN: 0in 0in 0pt;">
Download the service pack and report any issues you encounter, that’s the only way
we can make it better for you. (Even if the issues you encounter aren’t fixed in the
service pack, we still look at them and consider them for a next version of Visual
Studio).
</p>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/visual-studio-2010-sp-1-beta-announced">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=c90c6d1e-b2c0-45be-b730-6787422fec64" />
      </div>
    </content>
  </entry>
  <entry>
    <title>What's next for SilverLight</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2010/11/18/WhatsNextForSilverLight.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,9b227c00-4b15-4e51-a7ef-e0da60187ede.aspx</id>
    <published>2010-11-18T13:54:49.1745451-08:00</published>
    <updated>2010-11-18T13:54:49.1745451-08:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <p>
            <a href="http://posterous.com/getfile/files.posterous.com/paulvanbrenk/5nUxN4unZSvbHcdGhpiItZpmee1Ji0rgDYS3FosqicpR0X6UQO9CljnFt6Yu/image001.png">
              <img src="http://posterous.com/getfile/files.posterous.com/paulvanbrenk/sBd8zgcgmzudAQOZAHaOE2ckdobzf5oXzbA7pi3hrhMrs8ByCdZnLENrZHme/image001.png.scaled.500.jpg" width="500" height="162" />
            </a>
          </p>
          <p>
You will not only hear what’s coming next for SilverLight from Scott Guthrie,
but after all the other interesting session about databinding, performance, Windows
Phone 7 development there’s the After Party! (Sorry, the After Party is not
available online).
</p>
          <p>
          </p>
          <p>
More info and registration on <a href="http://www.silverlight.net/news/events/firestarter/"> Silverlight.net</a> for
attending in Redmond and online.
</p>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/whats-next-for-silverlight">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=9b227c00-4b15-4e51-a7ef-e0da60187ede" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Reviving my blog</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2010/06/23/RevivingMyBlog.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,463de2b3-d803-4c2e-a312-c6c4157eab11.aspx</id>
    <published>2010-06-23T04:30:41.136-07:00</published>
    <updated>2010-06-23T04:35:16.2322228-07:00</updated>
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="posterous_autopost">
          <div>So, it's been over a year..... which I know is a long time, but much has happened
in a very short time, so blogging was one of the casualties. But now that things have
settled down, I´m back!
</div>
          <div>
          </div>
          <div>So what has happened:
</div>
          <ul>
            <li>
After interning at Microsoft last summer, I got a job offer for a position in the
C# IDE QA Team, which I accepted.</li>
            <li>
I married my wife</li>
            <li>
We moved to the US (See 1)</li>
            <li>
Found a place to live</li>
            <li>
Worked hard on finishing my Bachelor's degree</li>
            <li>
Helped finish Visual Studio 2010 (a little)</li>
          </ul>
          <div>What's next? We'll start working on dev 11 (VS v.Next) soon, which will be exciting
since it's the first time I'll be involved in the entire product cycle from planning
till release. Hopefully a lot more blogging/tweeting (140 chars should be enough for
everyone).
</div>
          <div>
          </div>
          <div>btw. I'm posting this via posterous, it should show on my regular blog. (<a href="http://www.paulvanbrenk.com/">http://www.paulvanbrenk.com</a>) 
</div>
          <div>
          </div>
          <div>
          </div>
          <div>
          </div>
          <p style="font-size: 10px;">
            <a href="http://posterous.com">Posted via email</a> from <a href="http://paulvanbrenk.posterous.com/reviving-my-blog">Paul
van Brenk's posterous</a></p>
        </div>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=463de2b3-d803-4c2e-a312-c6c4157eab11" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Using dynamic for evil</title>
    <link rel="alternate" type="text/html" href="http://www.paulvanbrenk.com/blog/2009/05/30/UsingDynamicForEvil.aspx" />
    <id>http://www.paulvanbrenk.com/blog/PermaLink,guid,15e703f4-f2a1-42a4-b6c9-a02d914d9456.aspx</id>
    <published>2009-05-29T22:53:08.736-07:00</published>
    <updated>2009-05-29T22:56:55.6411461-07:00</updated>
    <category term="Development/C#" label="Development/C#" scheme="http://www.paulvanbrenk.com/blog/CategoryView,category,DevelopmentC.aspx" />
    <category term="Visual Studio 2010" label="Visual Studio 2010" scheme="http://www.paulvanbrenk.com/blog/CategoryView,category,VisualStudio2010.aspx" />
    <author>
      <name>Paul van Brenk</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The new dynamic keyword and the DLR in C# 4 and the .NET Framework 4.0 can be used
for good, as displayed by IronRuby, IronPython and <a href="http://www.nikhilk.net/CSharp-Dynamic-Programming-REST-Services.aspx">several</a><a href="http://www.nikhilk.net/CSharp-Dynamic-Programming-JSON.aspx">other</a><a href="http://blogs.msdn.com/vbteam/archive/2008/12/17/walkthrough-dynamic-programming-in-visual-basic-10-0-and-c-4-0-lisa-feigenbaum.aspx">samples</a>. 
</p>
        <p>
But it’s much more to fun to use it for evil… by making Reflection simple.
</p>
        <p>
In C# 3.0 invoking members through reflection, was kind of odd and certainly not very
readable.
</p>
        <blockquote>
          <pre class="csharpcode">var employee = <span class="kwrd">new</span> Employee();
var members = employee.GetType().GetMember(<span class="str">"age"</span>, MemberTypes.All,
BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
((FieldInfo)members[0]).SetValue(employee, 30);</pre>
        </blockquote>
        <blockquote>
        </blockquote>
        <p>
By wrapping all reflection magic in a dynamic object the same call would look like:
</p>
        <blockquote>
          <pre class="csharpcode">var employee = (<span class="kwrd">new</span> Employee()).AsDynamic();
employee.Name = <span class="str">"Paul van Brenk"</span>; employee.Age = 30; Console.WriteLine(<span class="str">"Employee
{0} is {1} years old."</span>, employee.Name, employee.Age);</pre>
        </blockquote>
        <p>
How this works is relatively easy.. by deriving a wrapper class from the new <a href="http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject(VS.100).aspx">DynamicObject</a> and
overriding the <a href="http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.trysetmember(VS.100).aspx">TrySetMember</a> and <a href="http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.trygetmember(VS.100).aspx">TryGetMember</a> object
to do the dirty work for you.
</p>
        <blockquote>
          <pre class="csharpcode">
            <span class="kwrd">static</span>
            <span class="kwrd">class</span> DynamicHelper
{ <span class="kwrd">public</span><span class="kwrd">static</span> dynamic AsDynamic<T>
(<span class="kwrd">this</span> T source) { <span class="kwrd">return</span><span class="kwrd">new</span> DynamicReflection<T>
(source); } <span class="kwrd">class</span> DynamicReflection<T>
: DynamicObject { <span class="kwrd">public</span> DynamicReflection(T source) : <span class="kwrd">base</span>()
{ <span class="kwrd">this</span>.Source = source; } <span class="kwrd">public</span><span class="kwrd">override</span><span class="kwrd">bool</span> TrySetMember(SetMemberBinder
binder, <span class="kwrd">object</span><span class="kwrd">value</span>) { <span class="rem">//
find the member</span> MemberInfo member; <span class="kwrd">if</span> (!TryFindMember(binder.Name, <span class="kwrd">out</span> member))
{ <span class="kwrd">return</span><span class="kwrd">false</span>; } <span class="rem">//
we can only set values to fields and properties</span><span class="rem">// using
reflection</span><span class="kwrd">switch</span> (member.MemberType) { <span class="rem">/*
todo: check the type of the incoming value and the type of </span><span class="rem"> the
property. */</span><span class="kwrd">case</span> (MemberTypes.Field): ((FieldInfo)member).SetValue(Source, <span class="kwrd">value</span>); <span class="kwrd">return</span><span class="kwrd">true</span>; <span class="kwrd">case</span> (MemberTypes.Property):
((PropertyInfo)member).SetValue(Source, <span class="kwrd">value</span>,<span class="rem">/*ndex*/</span><span class="kwrd">null</span>); <span class="rem">//
we don't support indexed properties</span><span class="kwrd">return</span><span class="kwrd">true</span>;
} <span class="rem">// didn't work</span><span class="kwrd">return</span><span class="kwrd">false</span>;
} <span class="kwrd">public</span><span class="kwrd">override</span><span class="kwrd">bool</span> TryGetMember(GetMemberBinder
binder, <span class="kwrd">out</span><span class="kwrd">object</span> result) { <span class="rem">//
find the member</span> MemberInfo member; <span class="kwrd">if</span> (!TryFindMember(binder.Name, <span class="kwrd">out</span> member))
{ result = <span class="kwrd">null</span>; <span class="kwrd">return</span><span class="kwrd">false</span>;
} <span class="rem">// we can only set values to fields and properties</span><span class="rem">//
using reflection</span><span class="kwrd">switch</span> (member.MemberType) { <span class="rem">/*
todo: check the type of the incoming value and the type of </span><span class="rem"> the
property. */</span><span class="kwrd">case</span> (MemberTypes.Field): result = ((FieldInfo)member).GetValue(Source); <span class="kwrd">return</span><span class="kwrd">true</span>; <span class="kwrd">case</span> (MemberTypes.Property):
result = ((PropertyInfo)member).GetValue(Source,<span class="rem">/*ndex*/</span><span class="kwrd">null</span>); <span class="rem">//
we don't support indexed properties</span><span class="kwrd">return</span><span class="kwrd">true</span>;
} <span class="rem">// didn't work</span> result = <span class="kwrd">null</span>; <span class="kwrd">return</span><span class="kwrd">false</span>;
} <span class="kwrd">private</span><span class="kwrd">bool</span> TryFindMember(<span class="kwrd">string</span> name, <span class="kwrd">out</span> MemberInfo
memberInfo) { <span class="rem">// find the member</span> var members = Type.GetMember(name,
MemberTypes.All, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic
| BindingFlags.Public); <span class="rem">// more than 1 not supported for now</span><span class="kwrd">if</span> (members.Length
!= 1) { memberInfo = <span class="kwrd">null</span>; <span class="kwrd">return</span><span class="kwrd">false</span>;
} memberInfo = members[0]; <span class="kwrd">return</span><span class="kwrd">true</span>;
} <span class="kwrd">private</span> Type Type { get { <span class="kwrd">return</span><span class="kwrd">typeof</span>(T);
} } <span class="kwrd">public</span> T Source { get; <span class="kwrd">private</span> set;
} } }
</T></T></T></pre>
        </blockquote>
        <p>
More info about implementing dynamic objects and behavior can be found on <a href="http://www.codeplex.com/dlr">the
DLR CodePlex site</a> (esp. <a href="http://dlr.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=68818">Getting
Started with the DLR as a Library Author</a>).
</p>
        <p>
Source: <a href="http://www.paulvanbrenk.com/blog/content/binary/Program.cs[1].txt">Program.cs.txt</a></p>
        <img width="0" height="0" src="http://www.paulvanbrenk.com/blog/aggbug.ashx?id=15e703f4-f2a1-42a4-b6c9-a02d914d9456" />
      </div>
    </content>
  </entry>
</feed>