<?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>Jamie Dixon &#187; resources</title>
	<atom:link href="http://www.jamie-dixon.co.uk/tag/resources/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamie-dixon.co.uk</link>
	<description>Web Developer, Software Engineer and Mixed Language Artist</description>
	<lastBuildDate>Thu, 18 Aug 2011 09:31:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Global Resource strings by property</title>
		<link>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/</link>
		<comments>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 15:10:44 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[concepts]]></category>
		<category><![CDATA[App_GlobalResources]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[resources]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=208</guid>
		<description><![CDATA[Every now and then I come across a bunch of string literals littered through out some code and begin the task of moving them out into their own resource file (.resx).
Gaining access to these strings from C# is pretty easy however I&#8217;m yet to find anywhere explaining it the way I find simplest.
Assuming your resx [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I come across a bunch of string literals littered through out some code and begin the task of moving them out into their own resource file (.resx).</p>
<p>Gaining access to these strings from C# is pretty easy however I&#8217;m yet to find anywhere explaining it the way I find simplest.</p>
<p>Assuming your resx file is stored in the App_GlobalResources folder, you can basically assign your resource file to a variable in your C# using the following syntax:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p208code3'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2083"><td class="code" id="p208code3"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Res </span><span style="color: #008000;">=</span> Resources<span style="color: #008000;">.</span><span style="color: #0000FF;">MyResourceFile</span></pre></td></tr></table></div>

<p>This then gives you the ability to referene the contents of the resource file as properties in your code.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p208code4'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2084"><td class="code" id="p208code4"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> x <span style="color: #008000;">=</span> Res<span style="color: #008000;">.</span><span style="color: #0000FF;">OneOfMyStringNames</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

