<?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>chillijam.co.uk &#187; .NET</title>
	<atom:link href="http://chillijam.co.uk/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://chillijam.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 20 May 2010 08:00:34 +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>Split a Camel-Cased word into its components</title>
		<link>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/</link>
		<comments>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/#comments</comments>
		<pubDate>Thu, 20 May 2010 08:00:03 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[Extension Methods]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=304</guid>
		<description><![CDATA[I needed to split a camel-cased word into it&#8217;s component parts, and found the following extension method to help out.  It works pretty well. public static string SplitCamelCase( this string str ) { return Regex.Replace( Regex.Replace( str, @&#34;(\P{Ll})(\P{Ll}\p{Ll})&#34;, &#34;$1 $2&#34; &#8230; <a href="http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I needed to split a camel-cased word into it&#8217;s component parts, and found the following extension method to help out.  It works pretty well.</p>
<pre class="brush: csharp;">
public static string SplitCamelCase( this string str )
{
return Regex.Replace( Regex.Replace( str, @&quot;(\P{Ll})(\P{Ll}\p{Ll})&quot;, &quot;$1 $2&quot; ), @&quot;(\p{Ll})(\P{Ll})&quot;, &quot;$1 $2&quot; );
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fuzzy-Matching of names</title>
		<link>http://chillijam.co.uk/2009/05/13/fuzzy-matching-of-names/</link>
		<comments>http://chillijam.co.uk/2009/05/13/fuzzy-matching-of-names/#comments</comments>
		<pubDate>Wed, 13 May 2009 11:51:37 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[fuzzy match]]></category>
		<category><![CDATA[jaro Winkler]]></category>
		<category><![CDATA[soundex]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=254</guid>
		<description><![CDATA[Yesterday at work, I had to try to knock together a quick application to parse a database table and pull out records with a matching name.  Simple at first glance, but more complex when you think about the common mis-spellings &#8230; <a href="http://chillijam.co.uk/2009/05/13/fuzzy-matching-of-names/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday at work, I had to try to knock together a quick application to parse a database table and pull out records with a matching name.  Simple at first glance, but more complex when you think about the common mis-spellings and abbreviations of names.  For example, Jonathan Miller may quite rightly be represented as Jon Miller, John Miller, Jo Miller and so on.  What I needed was a way to disambiguate these names for matchin purposes.</p>
<p>Conventional wisdom here would suggest the use of soundex patterns, and I agree that there are compelling arguments for this approach.  However, being the contrary soul that I am I decided soundex wasn&#8217;t quite good enough and went looking for alternatives.</p>
<p>I came across <a href="http://anastasiosyal.com/archive/2009/01/11/18.aspx" target="_blank">this blog post </a>outlining a SourceForge project from the <a href="http://nlp.shef.ac.uk/wig/" target="_blank">Web Intelligence Group</a> at the University of Sheffield.  I took 20 minutes to implement the pre-requisites to use the patterns, and have to say it seems to give me what I want.</p>
<p>I&#8217;m using the Jaro Winkler metric to provide the fuzzy matching I&#8217;m looking for, and I am also able to give the users a choice of the confidence level of the match.  A confidence level of 1 will only return data that matches exactly. Confidence level 0 would return everything.  A bit of trial andd error showed me that a confidence level of around 0.85 produced the best result for my purposes.  </p>
<p>An example of the query I used would be something like this&#8230;</p>
<pre class="brush: sql;">PROCEDURE [dbo].[GetResultsByFuzzyName]
	@FamilyName varchar(35),
	@GivenName varchar(35),
	@DateOfBirth datetime,
	@certaintyLevel int
AS
BEGIN
  SET NOCOUNT ON;

  DECLARE @cert float;
  SET @cert = CAST(@certaintyLevel as float) /10 

	select
    &lt;myFields&gt;
    ,dbo.JaroWinkler(upper(familyname),upper(@FamilyName)) as FamilyNameScore
    ,dbo.JaroWinkler(upper(Givenname),upper(@GivenName)) as GivenNameScore
  from
    &lt;myTableName&gt;
  where
    dbo.JaroWinkler(upper(familyname),upper(@FamilyName)) &gt;= @cert
  and
    dbo.JaroWinkler(upper(givenname),uppeR(@GivenName))  &gt;= @cert
  order by
    dbo.JaroWinkler(upper(familyname),upper(@FamilyName)) desc,
    dbo.JaroWinkler(upper(givenname),upper(@GivenName)) desc

END</pre>
<p>I could go further with this and do a bit more analysis with a second (or even third) matching algorithm, but for now I&#8217;m getting pretty good results.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/05/13/fuzzy-matching-of-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC &#8211; Deploying on Win XP</title>
		<link>http://chillijam.co.uk/2009/05/11/aspnet-mvc-deploying-on-win-xp/</link>
		<comments>http://chillijam.co.uk/2009/05/11/aspnet-mvc-deploying-on-win-xp/#comments</comments>
		<pubDate>Mon, 11 May 2009 12:42:30 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[iis5]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=242</guid>
		<description><![CDATA[This is the second in a series of posts about things I found out while learning ASP.NET MVC. Today : Setting up your development XP machine to run your site. This is actually quite a simple one, but be warned, &#8230; <a href="http://chillijam.co.uk/2009/05/11/aspnet-mvc-deploying-on-win-xp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the second in a series of posts about things I found out while learning ASP.NET MVC. Today : Setting up your development XP machine to run your site.</p>
<p>This is actually quite a simple one, but be warned, the overhead of setting up IIS5 to run an MVC site may lead to trouble if you put it under heavy load.</p>
<p>First, you&#8217;ll have to add a new Route to your Global.asax.cs file, just for IIS5.  For example :</p>
<p> </p>
<pre class="brush: csharp;">
routes.MapRoute(
      &quot;IIS5&quot;,  // Route name
      &quot;{controller}.mvc/{action}/{id}&quot;,  // URL with parameters&lt;/strong&gt;
      new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = &quot;&quot; }  // Parameter defaults
);</pre>
<p>Note in this example that the only difference (apart from the name) is the addition of a &#8220;.mvc&#8221; extension after the controller declaration.</p>
<p>Now, you just need to configure your IIS virtual directory.</p>
<p>In inetmgr, navigate to your virtual directory, right click it and select Properties.  On the default tab (&#8220;Directory&#8221;), click the Configuration button.  You now need to add a new file extension handler, so click on the &#8220;Add&#8221; button.</p>
<p>In the textbox for the executable, enter the path to aspnet_isapi.dll ([probably C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll), and set the extension to be &#8220;.*&#8221;.  Before you hit &#8220;OK&#8221;, make sure you untick the box marked &#8220;Check that file exists&#8221;.  Now you can hit OK a few times and you&#8217;re good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/05/11/aspnet-mvc-deploying-on-win-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC &#8211; Preparing for the real world</title>
		<link>http://chillijam.co.uk/2009/05/11/aspnet-mvc-preparing-for-the-real-world/</link>
		<comments>http://chillijam.co.uk/2009/05/11/aspnet-mvc-preparing-for-the-real-world/#comments</comments>
		<pubDate>Mon, 11 May 2009 10:46:04 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=236</guid>
		<description><![CDATA[This is the first in a series of posts about things I found out while learning ASP.NET MVC. Today : adding jQuery support that will work wherever the app is deployed in a directory structure. In order to reference the &#8230; <a href="http://chillijam.co.uk/2009/05/11/aspnet-mvc-preparing-for-the-real-world/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the first in a series of posts about things I found out while learning ASP.NET MVC.  Today : adding jQuery support that will work wherever the app is deployed in a directory structure.</p>
<p>In order to reference the jQuery javascript files, I had to figure out how to add a realtive link to the .js files that would work even if the app was deployed to an unknown virtual directory.  A quick question on <a href="http://stackoverflow.com">StackOverflow.com</a> led me to the following steps.</p>
<p>1) Create an extension method in the Helpers namespace&#8230;</p>
<pre class="brush: csharp;">public static string GetBasePath(this HtmlHelper helper)

{

    var urlHelper = new UrlHelper(helper.ViewContext.RequestContext);

    return urlHelper.Content(&quot;~/&quot;);

}</pre>
<p>Next, point the link tags for my js file to the new location&#8230;</p>
<pre class="brush: jscript;">&lt;script src=&quot;&lt;%= Html.GetBasePath() %&gt;Scripts/jquery-1.3.2.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 </pre>
<p>That&#8217;s it.  All I had to do.</p>
<p>Of course, since I want to call data back from my MVC site via jQuery, I had to take a couple of extra steps to make the base path available to my scripts.  Back in my master page, I created the following snippet.</p>
<pre class="brush: jscript;">&lt;script language=&quot;javascript&quot;&gt;

  var rootUrl = &quot;&lt;%= Html.GetBasePath() %&gt;&quot;; 

&lt;/script&gt;</pre>
<p>Now I can call the data back from the site within my custom-defined jQuery script as follows&#8230;</p>
<pre class="brush: jscript;">$('#preview').click(function() {

    $.get(rootUrl + &quot;jquery/getprovider/&quot; + $(this).attr(&quot;name&quot;), function(data) { $('#detailDiv').slideDown(300); $('#detailDiv').html(data); });

    });</pre>
<p>My #preview object has an id coded into its &#8216;name&#8217; attribute so the jQuery controller can reference the correct data., eg.</p>
<pre class="brush: xml;">&lt;a href=&quot;#&quot; name=&quot;12345&quot;&gt;details&lt;/a&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/05/11/aspnet-mvc-preparing-for-the-real-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>System.Linq &#8211; Unleash the power!</title>
		<link>http://chillijam.co.uk/2009/03/31/systemlinq-unleash-the-power/</link>
		<comments>http://chillijam.co.uk/2009/03/31/systemlinq-unleash-the-power/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 09:51:04 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Sets]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=211</guid>
		<description><![CDATA[I&#8217;ve been poking about with the System.Linq namespace in C# 3.5 this week.  Like most &#8220;new&#8221; areas of a language, it can be difficult to find the time or motivation to delve into the capabilities it provides, but I&#8217;ve just &#8230; <a href="http://chillijam.co.uk/2009/03/31/systemlinq-unleash-the-power/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been poking about with the System.Linq namespace in C# 3.5 this week.  Like most &#8220;new&#8221; areas of a language, it can be difficult to find the time or motivation to delve into the capabilities it provides, but I&#8217;ve just had it proven to me that I should have taken the plunge months ago.</p>
<p>In one small project, I have to compare two generic lists and pull out the records that are equal across the sets, as well as those that are different from one set to another (additions and deletions).  Luckily, the sets are fairly small, so the implementation I wrote last week is good enough to get the job done.  This week, however, I decided to do a quick benchmark to see how much faster it would be to use the new Linq-y methods.</p>
<p>First up, I created a small test class &#8211; MyType.</p>
<pre class="brush: csharp;">
public class MyType
{
	public int MyId { get; set; }
	public string GivenName { get; set; }
	public string FamilyName { get; set; }
	public DateTime DateOfBirth { get; set; }

	public override bool Equals(object obj)
	{
		if (null == obj) return false;
		MyType compareTo = obj as MyType;
		if (null == compareTo) return false;
		return (FamilyName == compareTo.FamilyName &amp;&amp; GivenName == compareTo.GivenName  &amp;&amp; DateOfBirth == compareTo.DateOfBirth);
	}
}
</pre>
<p>Next up, I created a comparer class, inheriting from IEqualityComparer&lt;MyType&gt;</p>
<pre class="brush: csharp;">public class MyTypeComparer : IEqualityComparer
{
	public bool Equals(MyType x, MyType y)
	{
		return (x.FamilyName == y.FamilyName  &amp;&amp; x.GivenName == y.GivenName  &amp;&amp; x.DateOfBirth == y.DateOfBirth);
	}

	public int GetHashCode(MyType obj)
	{
		return obj.GivenName.GetHashCode() ^ obj.FamilyName.GetHashCode() ^ obj.DateOfBirth.GetHashCode();
	}
}</pre>
<p>Next we create two collections of 10,000 members each.  I did that using the following snippet.</p>
<pre class="brush: csharp;">private void SetupDataForTest(int numberOfRecords)
{
	recordSetOne = new List();
	recordSetTwo = new List();
	matches = new List();
	matches2 = new List();

	for (int i = 0; i &lt; numberOfRecords; i++)
	{
		recordSetOne.Add(new MyType {MyId = i, GivenName=&quot;Trevor&quot;, FamilyName=&quot;Test&quot; + i.ToString(), DateOfBirth = new DateTime(1970,1,1).AddDays(i)});

		if(i % 3 == 0)
		{
			recordSetTwo.Add(new MyType { MyId = i, GivenName = &quot;Trevor&quot;, FamilyName = &quot;Test&quot; + i.ToString(), DateOfBirth = new DateTime(1970, 1, 1).AddDays(i) } );
		}
		else
		{
			recordSetTwo.Add(new MyType { MyId = i, GivenName=&quot;Ian&quot;, FamilyName=&quot;Wilson&quot; + (i*2).ToString(), DateOfBirth = new DateTime(1971,1,1).AddDays(i*2) } );
		}
	}
}</pre>
<p>So now we can get to the meat of the thing and find all the records that exist in both sets.  The old way of doing this was looping through the first set, and for each member loop through the second until we find a match (I&#8217;m not going to provide code &#8211; it&#8217;s too darned ugly).  Doing it this way took around 8 seconds on my dev machine.</p>
<p>The Linqy way, though is to use the Enumerable.Intersect method :</p>
<pre class="brush: csharp;">private void RunLinqTest()
{
	var intersection = recordSetOne.Intersect(recordSetTwo, new MyTypeComparer());
	matches.AddRange(intersection);
}</pre>
<p>Guess what?  Adding all the matches to a pre-existing collection returned the expected 3334 results, and took 7 <em>milliseconds</em>.Yes, milliseconds.  That means I could run this method 1142 times in the time it took to run the old way.</p>
<p>I&#8217;m not going to go into the specifics of how to pull out the added/deleted records (but I&#8217;ll give you a clue -&gt; <em>Enumerable.Except</em>), but the performance gains were enormous there, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/03/31/systemlinq-unleash-the-power/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7 on the MacBook</title>
		<link>http://chillijam.co.uk/2009/03/21/windows-7-on-the-macbook/</link>
		<comments>http://chillijam.co.uk/2009/03/21/windows-7-on-the-macbook/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 12:16:00 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[Win7]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=207</guid>
		<description><![CDATA[I’ve just installed Windows 7 on my MacBook’s BootCamp partition, and so far it looks great.&#160; I’m not new to Win7, having had it installed in a Parallels VM since it was released.&#160; The experience on the MacBook’s native hardware, &#8230; <a href="http://chillijam.co.uk/2009/03/21/windows-7-on-the-macbook/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’ve just installed Windows 7 on my MacBook’s BootCamp partition, and so far it looks great.&#160; I’m not new to Win7, having had it installed in a Parallels VM since it was released.&#160; The experience on the MacBook’s native hardware, though, is so much better.&#160; For a start, it doesn’t die when you try to run (or create) a WPF application.&#160; For a developer, that’s a pretty important thing. <img src='http://chillijam.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One niggle, though, I can’t get audio.&#160; I know <a href="http://discussions.apple.com/thread.jspa?threadID=1860928&amp;tstart=0">there’s a fix</a>, but after inserting my Leopard DVD, the drive has stopped responding.&#160; Now I have to boot back into OS X in order to eject the disc. </p>
<p>Oh well, I’m going back to playing with this OS, and seeing what it can really do. </p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/03/21/windows-7-on-the-macbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iterate through enum values</title>
		<link>http://chillijam.co.uk/2006/08/30/iterate-through-enum-values/</link>
		<comments>http://chillijam.co.uk/2006/08/30/iterate-through-enum-values/#comments</comments>
		<pubDate>Wed, 30 Aug 2006 11:16:28 +0000</pubDate>
		<dc:creator>historical</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://playingwithanimport.wordpress.com/2006/08/30/iterate-through-enum-values/</guid>
		<description><![CDATA[A quick example of how to iterate through the values in an enum&#8230; enum myEnum { one, two, three, four, five, }; foreach (int i in Enum.GetValues(typeof(myEnum ))) { myEnum myItem = (myEnum )Enum.ToObject(typeof(myEnum ), i); System.Diagnostics.Debug.WriteLine(myItem.ToString()); }]]></description>
			<content:encoded><![CDATA[<p>A quick example of how to iterate through the values in an enum&#8230;</p>
<p><code>enum myEnum { one, two, three, four, five, };<br />
foreach (int i in Enum.GetValues(typeof(myEnum )))<br />
{<br />
  myEnum myItem = (myEnum )Enum.ToObject(typeof(myEnum ), i);<br />
  System.Diagnostics.Debug.WriteLine(myItem.ToString());<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2006/08/30/iterate-through-enum-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A List of LiveWriter Plugins</title>
		<link>http://chillijam.co.uk/2006/08/18/a-list-of-livewriter-plugins/</link>
		<comments>http://chillijam.co.uk/2006/08/18/a-list-of-livewriter-plugins/#comments</comments>
		<pubDate>Fri, 18 Aug 2006 11:00:31 +0000</pubDate>
		<dc:creator>historical</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[LiveWriter Plugins]]></category>

		<guid isPermaLink="false">http://playingwithanimport.wordpress.com/2006/08/18/a-list-of-livewriter-plugins/</guid>
		<description><![CDATA[As well as my own humble effort, there are quite a few others out there writing LiveWriter plugins. A good place to start looking would be here or here.]]></description>
			<content:encoded><![CDATA[<p>As well as <a href="http://tat.chillijam.co.uk/2006/08/17/youtube-video-embed-livewriter-plugin/">my own humble effort</a>, there are quite a few others out there writing LiveWriter plugins.  A good place to start looking would be <a href="http://jeftek.spaces.live.com/blog/cns!F2042DC08607EF2!644.entry">here</a> or <a href="http://jeftek.spaces.live.com/blog/cns!F2042DC08607EF2!631.entry">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2006/08/18/a-list-of-livewriter-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So what am I up to now?</title>
		<link>http://chillijam.co.uk/2006/06/16/so-what-am-i-up-to-now/</link>
		<comments>http://chillijam.co.uk/2006/06/16/so-what-am-i-up-to-now/#comments</comments>
		<pubDate>Fri, 16 Jun 2006 16:17:38 +0000</pubDate>
		<dc:creator>historical</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Avanade]]></category>

		<guid isPermaLink="false">http://playingwithanimport.wordpress.com/2006/06/16/so-what-am-i-up-to-now/</guid>
		<description><![CDATA[Well, about 5 weeks ago I joined Avanade as a solution Developer, and since joining I&#8217;ve had all kinds of things going on &#8211; not least of which was a trip to Seattle for an orientation / training week. It &#8230; <a href="http://chillijam.co.uk/2006/06/16/so-what-am-i-up-to-now/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, about 5 weeks ago I joined <a href="http://www.avanade.com">Avanade</a> as a solution Developer, and since joining I&#8217;ve had all kinds of things going on &#8211; not least of which was a trip to Seattle for an orientation / training week.  It sounds terrible, b ut is actually really good.  I&#8217;ll be blogging about that later.<br />
I start my first customer facing role on Monday.  I&#8217;m not going to say anything about who it is for, or what it is doing, but it *is* going to teach me new skills, and give me the opportunity to meet some more of my colleagues &#8220;in the field&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2006/06/16/so-what-am-i-up-to-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determine if an assembly is a debug or release build</title>
		<link>http://chillijam.co.uk/2006/05/04/determine-if-an-assembly-is-a-debug-or-release-build/</link>
		<comments>http://chillijam.co.uk/2006/05/04/determine-if-an-assembly-is-a-debug-or-release-build/#comments</comments>
		<pubDate>Thu, 04 May 2006 15:47:46 +0000</pubDate>
		<dc:creator>historical</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://playingwithanimport.wordpress.com/2006/05/04/determine-if-an-assembly-is-a-debug-or-release-build/</guid>
		<description><![CDATA[*This code originally came from another blog, although it was written in VB over there. It has lost some elegance in the translation, but I needed a very quick solution this afternoon, and I needed it in C#, so here &#8230; <a href="http://chillijam.co.uk/2006/05/04/determine-if-an-assembly-is-a-debug-or-release-build/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>*This code originally came from <a href="http://msmvps.com/blogs/bill/archive/2004/06/17/8339.aspx">another blog</a>, although it was written in VB over there.  It has lost some elegance in the translation, but I needed a very quick solution this afternoon, and I needed it in C#, so here you go.  *</p>
<p>I needed to determine whether several assemblies were built as &#8220;Debug&#8221; or &#8220;Release&#8221; code this afternoon.  They didn&#8217;t have any debug symbols with them, so that was no help.  A bit of searching led me to the code below.</p>
<pre>
<pre class="brush: csharp;">private void testfile(string file)
{
	if(isAssemblyDebugBuild(file))
	{
		MessageBox.Show(String.Format(&quot;{0} seems to be a debug build&quot;,file));
	}
	else
	{
		MessageBox.Show(String.Format(&quot;{0} seems to be a release build&quot;,file));
	}
}

private bool isAssemblyDebugBuild(string filename)
{
	return isAssemblyDebugBuild(System.Reflection.Assembly.LoadFile(filename));
}

private bool isAssemblyDebugBuild(System.Reflection.Assembly assemb)
{
	bool retVal = false;
	foreach(object att in assemb.GetCustomAttributes(false))
	{
		if(att.GetType() == System.Type.GetType(&quot;System.Diagnostics.DebuggableAttribute&quot;))
		{
			retVal = ((System.Diagnostics.DebuggableAttribute)att).IsJITTrackingEnabled;
		}
	}
	return retVal;
}</pre>
</pre>
<p>The overloaded &#8220;isAssemblyDebugBuild&#8221; method will accept either a string containing the fiull filename, or a System.Reflection.Assembly object.  It will return its best guess as to whether the the assembly is a debug build, as a boolean.</p>
<p>To call the methods as they are (to get a MessageBox), just use something like</p>
<pre>
<pre class="brush: csharp;">testfile(@&quot;C:\myUnknownAssembly.dll&quot;);</pre>
</pre>
<p>or access the underlying methods directly :</p>
<pre>
<pre class="brush: csharp;">bool isDebug = isAssemblyDebugBuild(@&quot;C:\myUnkownAssembly.dll&quot;);</pre>
</pre>
<p>I hope someone can use this to save themselves some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2006/05/04/determine-if-an-assembly-is-a-debug-or-release-build/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
