<?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>Luke Payne Software &#187; Tutorials</title>
	<atom:link href="http://www.lukepaynesoftware.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lukepaynesoftware.com</link>
	<description></description>
	<lastBuildDate>Mon, 16 Jan 2012 01:00:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>‘Hacking’ Windows Media Player</title>
		<link>http://www.lukepaynesoftware.com/2011/01/18/hacking-windows-media-player/</link>
		<comments>http://www.lukepaynesoftware.com/2011/01/18/hacking-windows-media-player/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 08:04:23 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Main Page]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.lukepaynesoftware.com/?p=483</guid>
		<description><![CDATA[Interested in learning how to patch Windows Media Player to allow it to run multiple instances? Then, this is the article for you: http://www.lukepaynesoftware.com/downloads/HackingMediaPlayer This is a technical article, not intended for the general computer user. For a one-click patch to enable Windows Media Player to run multiple times, look here: http://www.lukepaynesoftware.com/other/]]></description>
			<content:encoded><![CDATA[<p>Interested in learning how to patch Windows Media Player to allow it to run multiple instances?<br />
Then, this is the article for you: <a href="http://www.lukepaynesoftware.com/downloads/HackingMediaPlayer" target="_blank">http://www.lukepaynesoftware.com/downloads/HackingMediaPlayer</a></p>
<p>This is a technical article, not intended for the general computer user. For a one-click patch to enable Windows Media Player to run multiple times, look here: <a href="http://www.lukepaynesoftware.com/other/">http://www.lukepaynesoftware.com/other/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lukepaynesoftware.com/2011/01/18/hacking-windows-media-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Hot Keys</title>
		<link>http://www.lukepaynesoftware.com/2010/08/06/c-hot-keys/</link>
		<comments>http://www.lukepaynesoftware.com/2010/08/06/c-hot-keys/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 07:30:25 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Main Page]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://lukepaynesoftware.com/?p=284</guid>
		<description><![CDATA[I will be describing two types of hot keys here: application hotkeys and system-wide hotkeys. Application hotkeys will be processed when your application is the active application, the key press anywhere else in the system will not alert your application. On the other hand a system-wide hotkey will alert your application whenever the key combination [...]]]></description>
			<content:encoded><![CDATA[<p>I will be describing two types of hot keys here: application hotkeys and system-wide hotkeys.<br />
Application hotkeys will be processed when your application is the active application, the key press anywhere else in the system will not alert your application. On the other hand a system-wide hotkey will alert your application whenever the key combination is pressed, no matter where the user is.</p>
<p><a href="http://lukepaynesoftware.com/programming-tutorials/hot-keys/">Read The Full Tutorial Here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lukepaynesoftware.com/2010/08/06/c-hot-keys/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What’s new in C# 4.0: Part 2: Windows 64-bit Support</title>
		<link>http://www.lukepaynesoftware.com/2010/07/10/what%e2%80%99s-new-in-c-4-0-part-2-windows-64-bit-support/</link>
		<comments>http://www.lukepaynesoftware.com/2010/07/10/what%e2%80%99s-new-in-c-4-0-part-2-windows-64-bit-support/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 23:40:34 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Main Page]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://lukepaynesoftware.com/?p=227</guid>
		<description><![CDATA[The Microsoft .NET framework 4 includes support for identifying whether the application is running in a 64-bit process or on a 64-bit operating system. You are able to check if you are running in a 64-bit process, by using Environment.Is64BitProcess, which returns a boolean of true if you are in a 64-bit process, or false [...]]]></description>
			<content:encoded><![CDATA[<p>The Microsoft .NET framework 4 includes support for identifying whether the application is running in a 64-bit process or on a 64-bit operating system.</p>
<p>You are able to check if you are running in a 64-bit process, by using <a href="http://msdn.microsoft.com/en-us/library/system.environment.is64bitprocess(VS.100).aspx">Environment.Is64BitProcess</a>, which returns a boolean of true if you are in a 64-bit process, or false if you are not.</p>
<p>You can check if the operating system in 64-bit by using <a href="http://msdn.microsoft.com/en-us/library/system.environment.is64bitoperatingsystem(VS.100).aspx">Environment.Is64BitOperatingSystem</a>, which also returns a boolean of true if you are on a 64-bit operating system, or false if you are not.</p>
<p>Another welcome addition is support to specify either a 64-bit or 32-bit version of the Windows Registry. You can specify either view using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.registryview.aspx">Microsoft.Win32.RegistryView enumeration</a>. For example, to open the 64-bit view of the Current User hive:</p>

<div class="wp_codebox"><table><tr id="p2272"><td class="code" id="p227code2"><pre class="csharp" style="font-family:monospace;">RegistryKey<span style="color: #008000;">.</span><span style="color: #0000FF;">OpenBaseKey</span><span style="color: #008000;">&#40;</span>RegistryHive<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUser</span>, RegistryView<span style="color: #008000;">.</span><span style="color: #0000FF;">Registry64</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>If you specify 64-bit view on a 32-bit operating system, the 32-bit view will be returned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lukepaynesoftware.com/2010/07/10/what%e2%80%99s-new-in-c-4-0-part-2-windows-64-bit-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What’s new in C# 4.0: Part 1: Optional Parameters &amp; Named Parameters</title>
		<link>http://www.lukepaynesoftware.com/2010/06/11/whats-new-in-c-4-0-part-1-optional-parameters-named-parameters/</link>
		<comments>http://www.lukepaynesoftware.com/2010/06/11/whats-new-in-c-4-0-part-1-optional-parameters-named-parameters/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 04:03:32 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Main Page]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://lukepaynesoftware.com/?p=183</guid>
		<description><![CDATA[Optional Parameters Prior to C# 4.0 the best method for optional parameters was method overloading. However, now C# 4.0 ships with the ability to have optional parameters, which are very simple to use. The biggest impact I think this will have is in COM interop, where you used to have to specify a value for [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Optional Parameters</strong></p>
<p>Prior to C# 4.0 the best method for optional parameters was method overloading. However, now C# 4.0 ships with the ability to have optional parameters, which are very simple to use. </p>
<p>The biggest impact I think this will have is in COM interop, where you used to have to specify a value for each parameter, optional or not.</p>
<p>Optional parameters are defined at the end of the parameter list, after required ones. Also, you may not specify any gaps in the argument list. If you provide an argument for an optional parameter, you must specify values for the previous parameters. However, if you know the name of the parameters you can get around this. For example here is a method to send an email:</p>

<div class="wp_codebox"><table><tr id="p1837"><td class="code" id="p183code7"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> SendEmail<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> AddressTo, <span style="color: #6666cc; font-weight: bold;">string</span> AddressFrom, <span style="color: #6666cc; font-weight: bold;">string</span> Subject <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Important&quot;</span>, <span style="color: #6666cc; font-weight: bold;">string</span> Signature <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Sent From Email Client&quot;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// ...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>So, the following call is not valid and will result in a compile error:</p>
<p><img src="http://lukepaynesoftware.com/images/tutorials/newin4/1/incorrect.png" alt="Incorrect" /></p>
<p>However, the following named call will work fine:</p>
<p><img src="http://lukepaynesoftware.com/images/tutorials/newin4/1/correct.png" alt="Correct" /></p>
<p>Each optional parameter you specify must have a default value, so if no argument is specified then the default value will be used. These default values must be constants. So, back to our previous method, &#8220;Subject&#8221; and &#8220;Signature&#8221; are both optional parameters:</p>

<div class="wp_codebox"><table><tr id="p1838"><td class="code" id="p183code8"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> SendEmail<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> AddressTo, <span style="color: #6666cc; font-weight: bold;">string</span> AddressFrom, <span style="color: #6666cc; font-weight: bold;">string</span> Subject <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Important&quot;</span>, <span style="color: #6666cc; font-weight: bold;">string</span> Signature <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Sent From Email Client&quot;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// ...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Named Parameters</strong></p>
<p>As you saw in optional parameters, another new feature is named parameters. Named parameters are helpful so you do not have to lookup the order of arguments for a method. </p>
<p>There is only one convention for named parameters, being that a named argument can not proceed a positional argument, however the opposite is acceptable.</p>
<p>Here is an example method:</p>

<div class="wp_codebox"><table><tr id="p1839"><td class="code" id="p183code9"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> ReverseName<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> FirstName, <span style="color: #6666cc; font-weight: bold;">string</span> LastName<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// ...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>We can used named parameters to change the order of the arguments:</p>

<div class="wp_codebox"><table><tr id="p18310"><td class="code" id="p183code10"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> ReversedName <span style="color: #008000;">=</span> ReverseName<span style="color: #008000;">&#40;</span>LastName<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;Payne&quot;</span>, FirstName<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;Luke&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Using named parameters can increase readibility of your code.</p>
<p>Look out for Part 2, coming soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lukepaynesoftware.com/2010/06/11/whats-new-in-c-4-0-part-1-optional-parameters-named-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Tutorials</title>
		<link>http://www.lukepaynesoftware.com/2010/06/05/new-tutorials/</link>
		<comments>http://www.lukepaynesoftware.com/2010/06/05/new-tutorials/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 06:31:03 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://lukepaynesoftware.com/?p=137</guid>
		<description><![CDATA[I am in the process of writing more tutorials from a long list of general queries I recieve, I hope to put a few new ones up each fortnight. Here is the next installment: Multi-monitor Programming in C# You can view all of the current tutorials on my tutorial page as I wont always update [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the process of writing more tutorials from a long list of general queries I recieve, I hope to put a few new ones up each fortnight.</p>
<p>Here is the next installment: <a href="http://lukepaynesoftware.com/tutorials/multi-monitor-programming-in-c/">Multi-monitor Programming in C#</a></p>
<p>You can view all of the current tutorials on my tutorial page as I wont always update the blog when there are new ones available.</p>
<p>Whilst I do have a list of ideas I am always looking for more so if there is something you would like to learn more about flick me an email!</p>
<p>Luke</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lukepaynesoftware.com/2010/06/05/new-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

