<?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>Resource File &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/tag/resource-file/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:16:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Resource File &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to read RESX file in C#</title>
		<link>https://sibeeshpassion.com/how-to-read-resx-file-in-c-sharp/</link>
					<comments>https://sibeeshpassion.com/how-to-read-resx-file-in-c-sharp/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 06 Jul 2015 11:16:08 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Manipulate Resource file]]></category>
		<category><![CDATA[Read RESX File]]></category>
		<category><![CDATA[Resource File]]></category>
		<category><![CDATA[RESX]]></category>
		<category><![CDATA[RESX in C#]]></category>
		<category><![CDATA[Using resource file]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=6351</guid>

					<description><![CDATA[[toc] Introduction In this article, you will learn how we can read a RESX file in our application using c#. I hope you will like it. Download Source Code Please feel free to download the source code from here: Using RESX  Background A few days back I used a RESX file in my application and I have set some error codes and details in it. It worked like a charm. So I thought of sharing you a demo of how we can use RESX file in our application. What is RESX file? The .resx resource file format consists of XML entries [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h2>Introduction</h2>
<p>In this article, you will learn how we can read a RESX file in our application using c#. I hope you will like it.</p>
<h2><strong>Download Source Code</strong></h2>
<p>Please feel free to download the source code from here: <a href="https://code.msdn.microsoft.com/How-to-read-RESX-file-in-C-3c967bca" target="_blank" rel="noopener">Using RESX </a></p>
<h2><strong>Background</strong></h2>
<p>A few days back I used a RESX file in my application and I have set some error codes and details in it. It worked like a charm. So I thought of sharing you a demo of how we can use RESX file in our application.</p>
<h3><strong>What is RESX file?</strong></h3>
<ul>
<li>The .resx resource file format consists of XML entries</li>
<li>These XML entries specify objects and strings inside XML tags</li>
<li>It can be easily manipulated</li>
</ul>
<h2><strong>Using the code</strong></h2>
<p>To start with, you need to create a web application. Here I am using Visual Studio 2012 and C# as the language.<br />
Once you created the application, you need to create a RESX file by clicking the &#8220;New Item&#8221;</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/07/UsingRESXFileinCSharp1.png"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-12680" src="http://sibeeshpassion.com/wp-content/uploads/2015/07/UsingRESXFileinCSharp1.png" alt="" width="594" height="663" srcset="/wp-content/uploads/2015/07/UsingRESXFileinCSharp1.png 594w, /wp-content/uploads/2015/07/UsingRESXFileinCSharp1-269x300.png 269w, /wp-content/uploads/2015/07/UsingRESXFileinCSharp1-400x446.png 400w, /wp-content/uploads/2015/07/UsingRESXFileinCSharp1-538x600.png 538w" sizes="(max-width: 594px) 100vw, 594px" /></a></p>
<p><img decoding="async" src="http://sibeeshpassion.com/Content/Images/UsingRESXFileinCSharp2.png" alt="" /></p>
<p>Now you can see a new file in your solution explorer named Resource1.resx</p>
<p><img decoding="async" src="http://sibeeshpassion.com/Content/Images/UsingRESXFileinCSharp3.png" alt="" /></p>
<p>So our RESX file is ready, right? Now we can set some values to that 🙂 You can see the values I set to my RESX file in the preceding image.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/Content/Images/UsingRESXFileinCSharp4.png" alt="" /></p>
<p>Now add a web page and go to the code behind by right click+view code . What you need to do next is, adding needed namespaces. You can find out them from the preceding code block.</p>
<p>[csharp]<br />
using System.Reflection;<br />
using System.Resources;<br />
using System.Globalization;<br />
[/csharp]</p>
<p>Once it is done, you are ready to go. Please paste the below mentioned code in your page load.</p>
<p>[csharp]<br />
ResourceManager rm = new ResourceManager(&#8220;UsingRESX.Resource1&#8221;,<br />
Assembly.GetExecutingAssembly());<br />
String strWebsite = rm.GetString(&#8220;Website&#8221;,CultureInfo.CurrentCulture);<br />
String strName = rm.GetString(&#8220;Name&#8221;);<br />
form1.InnerText = &#8220;Website: &#8221; + strWebsite + &#8220;&#8211;Name: &#8221; + strName;<br />
[/csharp]</p>
<p>So in the above code block we are getting the values of &#8220;Name&#8221; and &#8220;Website&#8221; which we have already set in the RESX file. Cool right?</p>
<p>[csharp]<br />
ResourceManager rm = new ResourceManager(&#8220;UsingRESX.Resource1&#8221;,<br />
Assembly.GetExecutingAssembly());<br />
[/csharp]</p>
<p>In the above mentioned code block we are setting our Resource file to the ResourceManager class. Please be noted that in <em>UsingRESX.Resource1</em>, <em>UsingRESX</em> is my project base name and <em>Resource1</em> is my resource file name. The function <em>GetString</em> is used to read the resource file properties 🙂</p>
<h3>Output</h3>
<p>Now it is time to see the output.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/Content/Images/UsingRESXFileinCSharp5.png" alt="" /></p>
<h2><strong>Conclusion</strong></h2>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h2><strong>Your turn. What do you think?</strong></h2>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/how-to-read-resx-file-in-c-sharp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
