<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Electron Sculptor</title><link>http://blogs.msdn.com/b/ebooth/</link><description>Ernie Booth's Blog</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Silverlight Fire Starter Videos</title><link>http://blogs.msdn.com/b/ebooth/archive/2008/01/07/silverlight-fire-starter-videos.aspx</link><pubDate>Tue, 08 Jan 2008 00:08:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7020247</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=7020247</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2008/01/07/silverlight-fire-starter-videos.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.adamkinney.com"&gt;Adam Kinney&lt;/a&gt; posted all of the &lt;a href="http://www.visitmix.com/University/silverlight/firestarter/"&gt;Fire Starter videos&lt;/a&gt; and the site has a cool Silverlight UI. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.visitmix.com/University/silverlight/firestarter/"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="384" alt="firestarter_500" src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SilverlightFireStarterVideos_B8B1/firestarter_500_3.jpg" width="511" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7020247" width="1" height="1"&gt;</description></item><item><title>Speaking @ Silverlight 1.0 Fire Starter</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/11/03/speaking-silverlight-1-0-fire-starter.aspx</link><pubDate>Sat, 03 Nov 2007 03:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5848113</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=5848113</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/11/03/speaking-silverlight-1-0-fire-starter.aspx#comments</comments><description>&amp;nbsp; 
&lt;P&gt;I will be speaking at the Silverlight 1.0 Fire Starter event on November 29th along with a bunch of my colleagues. My two sessions are "Media, Markers and More" and "What will Silverlight look like in future versions? WPF".&amp;nbsp; The first session goes into the gory details of working with Media in Silverlight 1.0. How you can use dynamic and static markers to bring a media experience some spice. And some of the pitfalls to avoid.&amp;nbsp; The second session is an introduction to programming with WPF and how what we see in WPF today will be reflected in Silverlight tomorrow.&amp;nbsp;&amp;nbsp; If your interested in attending the check out the invite below!&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_2.png"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_2.png"&gt;&lt;/A&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_4.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=141 alt=image src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_thumb_1.png" width=104 border=0 mce_src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SpeakingSilverlight1.0FireStarter_F516/image_thumb_1.png"&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;On November 29, 2007 Microsoft will be hosting &lt;B&gt;&lt;I&gt;Silverlight 1.0 Fire Starter&lt;/I&gt;&lt;/B&gt; on the Redmond, Washington campus. This daylong event is free to anyone who wants to learn about &lt;B&gt;&lt;I&gt;designing&lt;/I&gt;&lt;/B&gt; and &lt;B&gt;&lt;I&gt;developing&lt;/I&gt;&lt;/B&gt; with Microsoft Silverlight 1.0. &lt;BR&gt;&lt;B&gt;&lt;BR&gt;&lt;/B&gt;Microsoft Silverlight 1.0 is a cross platform browser plug-in that enables for easy development of media rich web sites. For more information, visit &lt;A href="http://silverlight.net/" mce_href="http://silverlight.net"&gt;http://silverlight.net&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;U&gt;November 29, 2007&lt;/U&gt; &lt;BR&gt;&lt;/B&gt;Microsoft Redmond Campus &lt;BR&gt;1 Microsoft Way &lt;BR&gt;Redmond, WA &lt;BR&gt;Building 33, Kodiak Room &lt;BR&gt;** Please have a photo ID with you to register onsite and park&lt;B&gt; &lt;BR&gt;&lt;/B&gt;&lt;B&gt;&lt;BR&gt;Check-in:&lt;/B&gt; 8:00 am &lt;BR&gt;&lt;B&gt;Event:&lt;/B&gt; 8:30 am – 5:00 pm &lt;BR&gt;&lt;B&gt;Register:&lt;/B&gt; &lt;A href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032359153&amp;amp;Culture=en-US" mce_href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032359153&amp;amp;Culture=en-US"&gt;http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032359153&amp;amp;Culture=en-US&lt;/A&gt; &lt;BR&gt;&lt;B&gt;&lt;I&gt;&lt;U&gt;or&lt;/U&gt;&lt;/I&gt;&lt;/B&gt; by calling&lt;B&gt; 1-877-673-8368&lt;/B&gt; and referencing &lt;B&gt;Event ID 1032359153&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;AGENDA&lt;/B&gt;&lt;/P&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=764 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;&lt;B&gt;&lt;I&gt;8:00 am – 8:30 am&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;&lt;B&gt;&lt;I&gt;Breakfast&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;8:30 am – 9:00 am &lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Introduction to Silverlight&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://blogs.msdn.com/mithund" mce_href="http://blogs.msdn.com/mithund"&gt;Mithun Dhar&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;9:00 am – 10:00 am&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Getting Started with Silverlight&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://blogs.msdn.com/webnext/" mce_href="http://blogs.msdn.com/webnext/"&gt;Laurence Moroney&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;&lt;B&gt;&lt;I&gt;10:00&lt;/I&gt;&lt;/B&gt;&lt;I&gt; am&lt;B&gt; – 10:15&lt;/B&gt; am&lt;B&gt; &lt;/B&gt;&lt;/I&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;&lt;B&gt;&lt;I&gt;Break&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;10:15 am – 11:15 am&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Microsoft Expression Design Tools&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://ux.artu.tv/" mce_href="http://ux.artu.tv/"&gt;Arturo Toledo&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;11:15 am – 12:15 pm&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;XAML Essentials for Silverlight&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://blogs.msdn.com/webnext/" mce_href="http://blogs.msdn.com/webnext/"&gt;Laurence Moroney&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;&lt;B&gt;&lt;I&gt;12:15 &lt;/I&gt;&lt;/B&gt;&lt;I&gt;pm&lt;B&gt; – 1:00 &lt;/B&gt;pm&lt;/I&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;&lt;B&gt;&lt;I&gt;Lunch&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;1:00 pm – 2:00 pm&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Developer Tools for Silverlight&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://adamkinney.com/" mce_href="http://adamkinney.com"&gt;Adam Kinney&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;2:00 pm – 3:00 pm&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Media, Markers and More&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://blogs.msdn.com/ebooth" mce_href="http://blogs.msdn.com/ebooth"&gt;Ernie Booth&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;&lt;B&gt;&lt;I&gt;3:00&lt;/I&gt; pm &lt;I&gt;– 3:15&lt;/I&gt; pm&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;&lt;STRONG&gt;&lt;EM&gt;Break&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;3:15 pm – 4:15 pm&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;Popfly and Silverlight – Writing a Silverlight ‘Social’ app&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://www.popfly.ms/" mce_href="http://www.popfly.ms/"&gt;Popfly Team&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;4:15 pm – 5:00 pm&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;What will Silverlight look like in future versions? WPF&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&lt;A href="http://blogs.msdn.com/ebooth" mce_href="http://blogs.msdn.com/ebooth"&gt;Ernie Booth&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=164&gt;&lt;B&gt;&lt;I&gt;Post Event&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=404&gt;&lt;B&gt;&lt;I&gt;Evening event with XBOX, networking and refreshments&lt;/I&gt;&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=194&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5848113" width="1" height="1"&gt;</description></item><item><title>Silverlight 1.0 Book!</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/10/27/silverlight-1-0-book.aspx</link><pubDate>Sun, 28 Oct 2007 00:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5719678</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=5719678</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/10/27/silverlight-1-0-book.aspx#comments</comments><description>My officemate and friend Laurence Moroney's Silverlight 1.0 book is now available.&amp;nbsp; Check out his detailed post here: &lt;A href="http://blogs.msdn.com/webnext/archive/2007/10/27/introducing-silverlight-1-0-book-is-now-available.aspx"&gt;http://blogs.msdn.com/webnext/archive/2007/10/27/introducing-silverlight-1-0-book-is-now-available.aspx&lt;/A&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5719678" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ebooth/archive/tags/Book/">Book</category><category domain="http://blogs.msdn.com/b/ebooth/archive/tags/Silverlight/">Silverlight</category></item><item><title>Silverlight Reflector Add-in Now a community Project</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/05/23/silverlight-reflector-add-in-now-a-community-project.aspx</link><pubDate>Wed, 23 May 2007 02:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2802398</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=2802398</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/05/23/silverlight-reflector-add-in-now-a-community-project.aspx#comments</comments><description>&lt;P&gt;&lt;A href="http://weblogs.asp.net/nunitaddin/default.aspx" mce_href="http://weblogs.asp.net/nunitaddin/default.aspx"&gt;Jamie Cansdale&lt;/A&gt; of Test Driven.Net has improved the Reflector Silverlight&amp;nbsp;Add-in and started a community project &lt;A class="" href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=SilverlightBrowser&amp;amp;referringTitle=Home" mce_href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=SilverlightBrowser&amp;amp;referringTitle=Home"&gt;here&lt;/A&gt;.&amp;nbsp; If you&amp;nbsp;have improvements, bugs,&amp;nbsp;or features request&amp;nbsp;please posted them to the community site. &lt;/P&gt;
&lt;P&gt;Jamie changed it so that the C# or VB&amp;nbsp;doesn't get displayed in tabs by defaut as this doesn't scale well for larger projects. You can still&amp;nbsp;digg through the code as the assembly is added to&amp;nbsp;Reflector.&amp;nbsp; He tested against all the &lt;A href="http://silverlight.net/community/gallerydetail.aspx?cat=2&amp;amp;sort=2#vid40" mce_href="http://silverlight.net/community/gallerydetail.aspx?cat=2&amp;amp;sort=2#vid40"&gt;samples&lt;/A&gt; on the Silverlight.net Site and found that the add-in&amp;nbsp;didn't scale well for the airplane sample.&lt;/P&gt;
&lt;P&gt;Jaime also has done some &lt;A href="http://weblogs.asp.net/nunitaddin/archive/2007/05/16/test-with-silverlight-coreclr.aspx" mce_href="http://weblogs.asp.net/nunitaddin/archive/2007/05/16/test-with-silverlight-coreclr.aspx"&gt;great work&lt;/A&gt; on integrating unit testing with Silverlight .NET that I would suggest checking out.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2802398" width="1" height="1"&gt;</description></item><item><title>View Source Reflector tool for .NET Silverlight Sites</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/05/19/view-source-reflector-tool-for-net-silverlight-sites.aspx</link><pubDate>Sat, 19 May 2007 03:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2721772</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>59</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=2721772</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/05/19/view-source-reflector-tool-for-net-silverlight-sites.aspx#comments</comments><description>&lt;P&gt;One of the nice advantages to Silverlight is that you can view the source of a site to see how things work, but with Silverlight 1.1 Alpha&amp;nbsp;that process became more complex.&amp;nbsp; While you can still fish through the JavaScript and Xaml to find the .NET assembly(dll) that is doing all the logic it takes a lot more time.&lt;/P&gt;
&lt;P&gt;Thus I decided to write a plugin for &lt;A title="Lutz's Website" href="http://www.aisto.com/roeder/dotnet/" target=_blank mce_href="http://www.aisto.com/roeder/dotnet/"&gt;Lutz Roeder's Reflector&lt;/A&gt; that takes a URL to a Silverlight page and finds the assembly for that page.&amp;nbsp; It also loads up the JavaScript and root Xaml for the page.&lt;/P&gt;
&lt;H1&gt;Download&lt;/H1&gt;
&lt;P&gt;Here is all the source and assembly&amp;nbsp;for the &lt;A class="" title=Reflector.SilverlightBrowser href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=SilverlightBrowser&amp;amp;referringTitle=Home" mce_href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=SilverlightBrowser&amp;amp;referringTitle=Home"&gt;0.2 Alpha&lt;/A&gt;&amp;nbsp;of the Reflector Silverlight Browser. &lt;/P&gt;
&lt;H1&gt;Install&lt;/H1&gt;
&lt;P&gt;To install the plugin:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Put the "Reflector.SilverlightBrowser.dll" file in the same directory as you have Reflector installed.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;Launch Reflector &lt;/LI&gt;
&lt;LI&gt;Choose "View-&amp;gt;Add-ins"&lt;/LI&gt;
&lt;LI&gt;Click Add&lt;/LI&gt;
&lt;LI&gt;Choose the Reflector.SilverlightBrowser.dll file.&lt;/LI&gt;
&lt;LI&gt;To test the plugin try the &lt;A class="" href="http://silverlight.net/samples/1.1/chess/run/default.html" mce_href="http://silverlight.net/samples/1.1/chess/run/default.html"&gt;chess game&lt;/A&gt;&amp;nbsp;sample from Silverlight.net&lt;/LI&gt;&lt;/OL&gt;
&lt;H1&gt;Using the Plugin&lt;/H1&gt;
&lt;P&gt;Once it is installed&amp;nbsp;hit "CRTL+U" or "File-&amp;gt;Open Silverlight URL".&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Paste a link to your favorite Silverlight site into the textbox and hit go.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/ViewSourceReflectort.NETSilverlightSites_F52C/image%7B0%7D%5B6%5D.png" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/ViewSourceReflectort.NETSilverlightSites_F52C/image%7B0%7D%5B6%5D.png" atomicselection="true"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=511 src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/ViewSourceReflectort.NETSilverlightSites_F52C/image%7B0%7D_thumb%5B4%5D.png" width=679 border=0 mce_src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/ViewSourceReflectort.NETSilverlightSites_F52C/image%7B0%7D_thumb%5B4%5D.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Protecting Your Code&lt;/H1&gt;
&lt;P&gt;So the feedback I get when I tell people about this plugin is how can&amp;nbsp;protect the IP in my&amp;nbsp;code from being seen by other people. I have two pieces of advice on that subject.&amp;nbsp; First option is to keep the code you want to keep protected on your server and then make webservice calls from your client to that code.&lt;/P&gt;
&lt;P&gt;The second option is to use Obfuscation.&amp;nbsp; What is Obfuscation you say?&amp;nbsp;"In the context of software, obfuscation is the process of scrambling the symbols, code, and data of a program to prevent reverse engineering."&amp;nbsp;- &lt;A href="http://blogs.msdn.com/clrsecurity" mce_href="http://blogs.msdn.com/clrsecurity"&gt;CLR and .NET Security blog&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If you would like to learn more about Obfuscation check out this &lt;A href="http://blogs.msdn.com/clrsecurity/archive/2005/05/26/422440.aspx" mce_href="http://blogs.msdn.com/clrsecurity/archive/2005/05/26/422440.aspx"&gt;great post.&lt;/A&gt;&lt;/P&gt;
&lt;H1&gt;Bugs and Features&lt;/H1&gt;
&lt;P&gt;First off I wrote this in a matter of a day or two with some great guidance from Lutz Roeder so a big thank&amp;nbsp;you to Lutz. Thus there are inevitably going to be a number of bugs in the code.&amp;nbsp; You have code so feel free to improve it and use it as you like. &lt;/P&gt;
&lt;P&gt;The major issue I am going to hear about is that some particular site doesn't work correctly, if you find a site that doesn't work that you would like to have work please send me the link.&lt;/P&gt;
&lt;P&gt;Second what features are missing that you would like to see? &lt;/P&gt;
&lt;P&gt;Third I would love to hear any other feedback you might have to offer.&lt;/P&gt;
&lt;P&gt;Enjoy!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2721772" width="1" height="1"&gt;</description></item><item><title>Silverlight C# 3.0 Features</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/05/13/silverlight-c-3-0-features.aspx</link><pubDate>Sun, 13 May 2007 06:55:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2589904</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=2589904</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/05/13/silverlight-c-3-0-features.aspx#comments</comments><description>&lt;p&gt;The .NET framework version Silverlight targets is the same that C# 3.0 targets and so we are able to take advantage of the new language features in C# 3.0.&amp;nbsp;The LINQ (&lt;strong&gt;L&lt;/strong&gt;anguage &lt;strong&gt;IN&lt;/strong&gt;tegrated &lt;strong&gt;Q&lt;/strong&gt;uery) features of C# 3.0 has gotten the most attention of any of the new features, but some of the other features are my favorite additions to the language. I will a link to learning more about LINQ at the end of this post. &lt;p&gt;Let's start looking at the feature in C# 3.0 by looking at the code listing from my previous post.&amp;nbsp; Here it is as I wrote it: &lt;p&gt;&lt;strong&gt;C# without 3.0 Features&lt;/strong&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Controls;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Documents;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Ink;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Input;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Media;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Media.Animation;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Shapes;

&lt;span style="color: rgb(0,0,255)"&gt;namespace&lt;/span&gt; ManagedSilverlight101
{
    &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;partial&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Page&lt;/span&gt; : Canvas
    {
        &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Page_Loaded(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; o, EventArgs e)
        {
            &lt;span style="color: rgb(0,128,0)"&gt;// Required to initialize variables
&lt;/span&gt;            InitializeComponent();

            parentCanvas = (Canvas)FindName(&lt;span style="color: rgb(163,21,21)"&gt;"parentCanvas"&lt;/span&gt;);

            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.ParentCanvas.Background = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; SolidColorBrush(Color.FromRgb(255, 0, 0));

            Ellipse childShape = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; Ellipse();

            childShape.Width = 100;
            childShape.Height = 100;

            LinearGradientBrush lgb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; LinearGradientBrush();

            GradientStop gs1 = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop();
            gs1.Color = Color.FromRgb(0, 0, 255);
            lgb.GradientStops.Add(gs1);

            GradientStop gs2 = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop();
            gs2.Color = Color.FromRgb(0, 255, 0);
            gs2.Offset = 1;
            lgb.GradientStops.Add(gs2);

            childShape.Fill = lgb;

            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.parentCanvas.Children.Add(childShape);
        }

        &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; Canvas parentCanvas;

        &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; Canvas ParentCanvas
        {
            &lt;span style="color: rgb(0,0,255)"&gt;get&lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; parentCanvas; }
            &lt;span style="color: rgb(0,0,255)"&gt;set&lt;/span&gt; { parentCanvas = &lt;span style="color: rgb(0,0,255)"&gt;value&lt;/span&gt;; }
        }
    }
}&lt;/pre&gt;
&lt;p&gt;There is nothing particularly special about the previous code listing, but a few item's to notice. First in the Page_Loaded method it is difficult to descern what the intent of the programmer was.&amp;nbsp; Unlike Xaml where everything is declarative the code above is very procedural. All that is happening of course is that the program is displaying a red rectangle containing a small circle with a blue to green gradient color.&amp;nbsp;&amp;nbsp;Something like this:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SilverlightC3.0Features_DBAA/image%7B0%7D%5B1%5D.png" atomicselection="true"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="179" src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/SilverlightC3.0Features_DBAA/image%7B0%7D.png" width="240" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This was so non obvious from the code above I original thought we were trying to display a red rectangle containing a smaller rectangle with a blue to green gradient color.&amp;nbsp; My eyes scanned the program above and failed to notice that the code was creating and Ellipse instead of a rectangle.&lt;/p&gt;
&lt;p&gt;If had tried to achieve this same result with xaml the code would look this this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Canvas&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;parentCanvas&lt;/span&gt;"
&lt;span style="color: rgb(0,0,255)"&gt;        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;xmlns&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;http://schemas.microsoft.com/client/2007&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt; 
        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt; 
        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Loaded&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;Page_Loaded&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt; 
        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;x:Class&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;ManagedSilverlight101.Page;assembly=ClientBin/ManagedSilverlight101.dll&lt;/span&gt;"
&lt;span style="color: rgb(0,0,255)"&gt;        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;640&lt;/span&gt;"
&lt;span style="color: rgb(0,0,255)"&gt;        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;480&lt;/span&gt;"
&lt;span style="color: rgb(0,0,255)"&gt;        &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Background&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;Red&lt;/span&gt;"
&lt;span style="color: rgb(0,0,255)"&gt;        &amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Ellipse&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;100&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;100&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Ellipse.Fill&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;GradientStop&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Color&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;Blue&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;/&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;GradientStop&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Color&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;Green&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;Offset&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;=&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;1&lt;/span&gt;"&lt;span style="color: rgb(0,0,255)"&gt;/&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Ellipse.Fill&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Ellipse&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;Canvas&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This is much easier to quickly read and understand what the program will do. The problem of course is that often times we don't have the ability to statically define our display because of the dynamic nature of a given program. This is where the features in C# 3.0 come into play.&amp;nbsp; Below is a code listing that I have transformed from our original code to instead use the new features of the language.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;C# 3.0 Style&lt;/strong&gt;
&lt;/p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Controls;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Documents;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Ink;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Input;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Media;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Media.Animation;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Windows.Shapes;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Collections.Generic;

&lt;span style="color: rgb(0,0,255)"&gt;namespace&lt;/span&gt; ManagedSilverlight101
{
    &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;partial&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Page&lt;/span&gt; : Canvas
    {
        &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Page_Loaded(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; o, EventArgs e)
        {
            &lt;span style="color: rgb(0,128,0)"&gt;// Required to initialize variables
&lt;/span&gt;            InitializeComponent();

            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.ParentCanvas = (Canvas)FindName(&lt;span style="color: rgb(163,21,21)"&gt;"parentCanvas"&lt;/span&gt;);

            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.ParentCanvas.Background = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; SolidColorBrush(Color.FromRgb(255, 0, 0));

            &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; stops = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStopCollection { 
                            &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 0, 255) },
                            &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 255, 0), Offset = 1 } };

            &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; lgb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; LinearGradientBrush() { GradientStops = stops };

            &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; childShape = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; Ellipse { Width = 100, Height = 100, Fill = lgb };

            &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.ParentCanvas.Children.Add(childShape);                
        }
        &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; Canvas ParentCanvas { &lt;span style="color: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="color: rgb(0,0,255)"&gt;set&lt;/span&gt;; }   
    }
}&lt;/pre&gt;
&lt;p&gt;We have reduced the length of our program and increased it's readability. It&amp;nbsp;in fact is very declarative like the Xaml. Let's examine the new features of C# 3.0 I am using in this example.&amp;nbsp; First after the call to the method&amp;nbsp;InitializeComponent we are assigning the property ParentCanvas from the result of the FindName.&amp;nbsp; This code on it's own isn't any different, but if our eyes scan to the bottom of the Page class we have the line:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; Canvas ParentCanvas { &lt;span style="color: rgb(0,0,255)"&gt;get&lt;/span&gt;; &lt;span style="color: rgb(0,0,255)"&gt;set&lt;/span&gt;; } &lt;/p&gt;
&lt;p&gt;This line is defining a new property named Canvas. Notice that we didn't have to create a separate field to hold the data that is being set by the ParentCanvas property.&amp;nbsp; This is a great shortcut to creating properties which is a good programming practice since in the feature we can change how the data is stored or retrieved without breaking the Page interface.&lt;/p&gt;
&lt;p&gt;The next change to our program is the statement:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; stops = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStopCollection { &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 0, 255) }, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 255, 0), Offset = 1 } }; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Implicitly Typed Local Variables&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is using a few new features of C#. The first is this part of the statement:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; stops = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStopCollection &lt;/p&gt;
&lt;p&gt;We are creating a variable named stops which is of type GradientStopCollection.&amp;nbsp; It is often cumbersome to write the name of the type on both sides of an assignment statement. By placing the var keyword before the name of our variable we are telling the compiler to infer the type information for stops from the type on the right hand side of the assignment operation.&amp;nbsp; In this case a GradientStopCollection.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Unlike JavaScript or other loosely typed languages the local variable stops is strongly typed.&amp;nbsp; Indeed if we were to say something like this after the creating of the stops variable:&lt;/p&gt;&lt;pre class="code"&gt; stops = &lt;span style="color: rgb(163,21,21)"&gt;"Hello"&lt;/span&gt;;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;The compiler will throw the error: Cannot implicitly convert type 'string' to 'System.Windows.Media.GradientStopCollection'.&amp;nbsp; This is because stops is in fact an instance of a GradientStopCollection.&amp;nbsp;The var keyword is simply a shorthand convenience.
&lt;p&gt;&lt;strong&gt;Collection Initializers&lt;/strong&gt;
&lt;p&gt;The next C# feature is in this part of that statement:
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStopCollection { ... };
&lt;p&gt;It is creating a new GradientStopCollection and then calling Add() passing each element in between the curly braces.&amp;nbsp; A simpler example looks like this:&lt;pre class="code"&gt;&lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; digits = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;and is semantically the same as this code:&lt;pre class="code"&gt; &lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; digits = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;();
            
 digits.Add(0);
 digits.Add(1);
 digits.Add(2);
 digits.Add(3);
 digits.Add(4);
 digits.Add(5);
 digits.Add(6);
 digits.Add(7);
 digits.Add(8);
 digits.Add(9);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;And if fact this is what the compiler is generating for us when we use this syntax.&amp;nbsp; It is called a collection initializer is a natural extension to how we were already able to assign items to an array:&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; [] digits = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Object Initializers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The last new feature in that same statement applies to the elements we are adding to the collection:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 0, 255) },&amp;nbsp;&lt;br&gt; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 255, 0), Offset = 1 } &lt;/p&gt;
&lt;p&gt;Here we are using a feature called Object Initializers. Just like a Collection Initializers we are using a curly brace instead of a parentheses after:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop {&lt;/p&gt;
&lt;p&gt;Then we are have some code that looks like this:&lt;/p&gt;
&lt;p&gt;Color = Color.FromRgb(0, 255, 0), Offset = 1 &lt;/p&gt;
&lt;p&gt;If this looks like property assignment that's because it is.&amp;nbsp; We are simply setting the Color and Offset properties of the GradientStop objects we are creating. That produces much cleaner code then the alternative syntax:&lt;/p&gt;
&lt;p&gt;GradientStop gs2 = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop(); gs2.Color = Color.FromRgb(0, 255, 0); gs2.Offset = 1; &lt;/p&gt;
&lt;p&gt;In fact when we combine all three of those features into one statement we are left much easier to read code:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; stops = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStopCollection { &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 0, 255) },&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop { Color = Color.FromRgb(0, 255, 0), Offset = 1 } }; &lt;/p&gt;
&lt;p&gt;Compared to:&lt;/p&gt;
&lt;p&gt;LinearGradientBrush lgb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; LinearGradientBrush(); &lt;br&gt;&lt;/p&gt;
&lt;p&gt;GradientStop gs1 = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop();&lt;br&gt; gs1.Color = Color.FromRgb(0, 0, 255); &lt;br&gt;lgb.GradientStops.Add(gs1); &lt;br&gt;&lt;br&gt;GradientStop gs2 = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; GradientStop(); &lt;br&gt;gs2.Color = Color.FromRgb(0, 255, 0); &lt;br&gt;gs2.Offset = 1; &lt;br&gt;lgb.GradientStops.Add(gs2); &lt;/p&gt;
&lt;p&gt;Also notice that we didn't have come up with local variable names for our GradientStops.&amp;nbsp; Which also makes for easier to maintain code. &lt;/p&gt;
&lt;p&gt;The last two changes to our program are just making use of the same new C# features described above:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; lgb = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; LinearGradientBrush() { GradientStops = stops }; &lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; childShape = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; Ellipse { Width = 100, Height = 100, Fill = lgb }; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As you have seen some of the new features is C# 3.0 make code much more readable and hopefully maintainable. There are a lot of other exciting features in both C# and VB thanks to LINQ.&amp;nbsp;If you are interested in learning about all  other great new features check out this &lt;a href="http://msdn2.microsoft.com/en-us/library/aa479865.aspx"&gt;great MSDN article&lt;/a&gt; on LINQ by Anders Hejlsberg and Don Box.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2589904" width="1" height="1"&gt;</description></item><item><title>Silverlight .NET introduction for JavaScript Developers (Updated)</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/05/08/silverlight-net-introduction-for-javascript-developers.aspx</link><pubDate>Wed, 09 May 2007 01:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2488993</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=2488993</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/05/08/silverlight-net-introduction-for-javascript-developers.aspx#comments</comments><description>&lt;P&gt;To begin our .NET Silverlight learning we will start off with an overview of .NET. For those are used to developing Silverlight applications&amp;nbsp;with JavaScript, we will be concentrating on the differences between using JavaScript and .NET.&amp;nbsp; If you haven't written a Silverlight application before this will also be a good introduction to using .NET.&amp;nbsp; If .NET is old hat for you by now then&amp;nbsp;most of this will be review, but there are still some important differences with regard to how Silverlight works compared to WPF (Windows Presentation Foundation).&lt;/P&gt;
&lt;H1&gt;&lt;STRONG&gt;Why .NET?&lt;/STRONG&gt;&lt;/H1&gt;
&lt;P&gt;A question that often comes up when we talk about .NET and Silverlight is why do we need .NET when JavaScript has already proven it's self as a great way to develop web applications.&amp;nbsp; Four reasons spring to mind right way.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Consistency&lt;/STRONG&gt; is the first reason compared to JavaScript, not in the core EcmaScript it's self, but more on the DOM side or how we access the page elements.&amp;nbsp; For each browser the DOM is different and only an experienced web developer knows how to write code that works well in all browsers.&amp;nbsp; With Silverlight we bypass most of this problem as we are targeting XAML and the Silverlight object model instead of the browsers object model.&amp;nbsp;The other part of this problem is that when you are using JavaScript you are relying on each browser's implementation of the JavaScript execution engine.&amp;nbsp; This is where .NET differs.&amp;nbsp; When we write a .NET application it is the Silverlight plugin which handles the execution of our code so there are no differences from one browser to the next. It is the same on Mac, Windows, Firefox, Safari and IE!&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Performance&lt;/STRONG&gt; is a great reason to use .NET over JavaScript.&amp;nbsp; Scott Guthrie had a great demonstration in his &lt;A href="http://www.visitmix.com/Blogs/Joshua/ray-ozzie-and-scott-guthrie-keynote/" mce_href="http://www.visitmix.com/Blogs/Joshua/ray-ozzie-and-scott-guthrie-keynote/"&gt;MIX keynote&lt;/A&gt; which showed off a chess game which implemented chess algorithms.&amp;nbsp; Once in JavaScript and once with .NET.&amp;nbsp; The performance comparison between the two was staggering. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Type Safety&lt;/STRONG&gt; is one that rings home with me.&amp;nbsp; I love the fact that when I compile I get feedback that my code is wrong and I have a chance to fix my mistakes before running the application. While Type Safety is great there are a lot of features in JavaScript which I have grown to enjoy. C# 3.0 has some new language features such as local type inferencing,&amp;nbsp;anonymous types, extension methods&amp;nbsp;and type intializers which allow for quick development similar to JavaScript while maintaining Type Safety.&amp;nbsp; We will get to some of those features a&amp;nbsp;bit later.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;.NET Framework&lt;/STRONG&gt; is the most compelling reason to use .NET.&amp;nbsp; The framework is a collection of libraries for a variety of tasks, from UI development to security and networking. While the Silverlight version of the .NET framework is much smaller then the full .NET Framework it can still be a lot to learn. I remember when I first started with .NET back in 2000 I would write some code to do x and then later I would discover that there was already a class which did x.&amp;nbsp; Since then a lot has been written so we can search to see what libraries we can use, but there is still no replacement for discovering all that the .NET Framework has to offer.&lt;/P&gt;
&lt;P&gt;There are a bunch of other reasons to use .NET like the support for multiple language 37 at last count including, IronPython, IronRuby, JavaScript, Cobal, PHP, C#, VB, C++\CLI, Ada, Boo, Chrome, Eiffel, Forth, FORTRAN, Haskell and many more. Here is a a more &lt;A href="http://www.dotnetlanguages.net/DNL/Resources.aspx" mce_href="http://www.dotnetlanguages.net/DNL/Resources.aspx"&gt;complete list&lt;/A&gt;.&lt;/P&gt;
&lt;H1&gt;Desktop .NET vs. Silveright .NET&lt;/H1&gt;
&lt;P&gt;There are a few differences between the full .NET Framework and the version that ships with Silverlight 1.1 Alpha.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Cross Platform, Cross Browser&lt;/STRONG&gt; is very important to Silverlight and so just like the rest of Silverlight the .NET components will work on Mac and Windows.&amp;nbsp; They will also run in FireFox, IE and Safari.&amp;nbsp; There is no difference between the framework when running on different platforms.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Size&lt;/STRONG&gt; of the Silverlight .NET version is about 4 MBs in the 1.1 Alpha.&amp;nbsp; This is significantly smaller then the full framework which is around 50 MBs.&amp;nbsp; In order to maximize user experience the size and install time were greatly reduced so that users with out Silverlight can still be targeted by Silverlight web sites.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sandbox&lt;/STRONG&gt; model is a way to provide full .NET applications in Silverlight without having to prompt users for install.&amp;nbsp; It provides a safe way to run applications, but has a few restrictions.&amp;nbsp; There is limited file access, so that you can't just start enumerating the files on a users machine. Networking support, no socket support. No elevation prompts and no ability to escape the sandbox.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Getting Started&lt;/H1&gt;
&lt;P&gt;The first place to start is to&amp;nbsp;define what is required to create a .NET Silverlight application.&amp;nbsp; There are four basic ingredients in any Silverlight 1.1 program:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;An html file&lt;/STRONG&gt; to hose our Silverlight plugin with. 
&lt;LI&gt;&lt;STRONG&gt;JavaScript&amp;nbsp;files&lt;/STRONG&gt;&amp;nbsp;which load the plugin with the appropriate settings such as Height, Width and Windowless. 
&lt;LI&gt;&lt;STRONG&gt;A XAML&lt;/STRONG&gt; file which defines the look of our root page and more importantly points at our .NET code to run. 
&lt;LI&gt;&lt;STRONG&gt;.NET&amp;nbsp;Assembly (dll)&lt;/STRONG&gt;&amp;nbsp;which houses all of the logic from our .NET code.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;What you need to Install&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Silverlight 1.1 Alpha 
&lt;LI&gt;Visual Studio "Orcas" Beta 1 
&lt;LI&gt;Silverlight Tools for Visual Studio "Orcas" Beta 1&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Creating a New Silverlight .NET project in Visual Studio&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now that you have everything installed lets start by having visual studio create a project for us. &lt;/P&gt;
&lt;P&gt;Open Visual Studio "Orcas".&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;NOTE: If this is the first time you have opened Visual Studio you will be prompted to choose which setup you want, C#, VB, C++, etc.&amp;nbsp; This simple configures menus, and toolbar layout, it doesn't restrict you from creating projects with the other languages.&lt;/EM&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;From the menu choose File-&amp;gt;New-&amp;gt;Project (CRTL+SHIFT+N) 
&lt;LI&gt;In the Dialog that pops up expand the Visual C# node and choose the Silverlight node. 
&lt;LI&gt;Make sure the Silverlight Project is highlighted. 
&lt;LI&gt;In the name field at the bottom of the dialog write&amp;nbsp;"ManagedSilverlight101" 
&lt;LI&gt;Click OK&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Visual Studio will create a project containing a number of files for us. On the right in Visual Studio our Solution Explorer should look like the image below:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image01.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image01.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=240 src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image0.png" width=230 border=0 mce_src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image0.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;We will start exploring each of the files to see what our Silverlight project is made of.&amp;nbsp; We will begin with TestPage.htm. Double click it in the solution explorer and it will open in Visual Studio.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TestPage.htm&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Here are the contents of our html file:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&amp;lt;html xmlns="&lt;/FONT&gt;&lt;A href="http://www.w3.org/1999/xhtml%22" mce_href='http://www.w3.org/1999/xhtml"'&gt;&lt;FONT face=Consolas&gt;http://www.w3.org/1999/xhtml"&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Consolas&gt;&amp;gt;&lt;BR&gt;&amp;lt;!-- saved from url=(0014)about:internet --&amp;gt;&lt;BR&gt;&amp;lt;head&amp;gt;&lt;BR&gt;&amp;lt;title&amp;gt;Silverlight Project Test Page &amp;lt;/title&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Consolas&gt;&lt;FONT color=#ff0000&gt;&amp;lt;script type="text/javascript" src="Silverlight.js" mce_src="Silverlight.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR&gt;&amp;lt;script type="text/javascript" src="TestPage.html.js" mce_src="TestPage.html.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;BR&gt;&amp;lt;/head&amp;gt; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&amp;lt;!-- Give the keyboard focus to the Silverlight control by default --&amp;gt;&lt;BR&gt;&amp;lt;body onload="document.getElementById('SilverlightControl').focus()"&amp;gt;&lt;BR&gt;&amp;lt;div id="&lt;FONT color=#008000&gt;SilverlightControlHost&lt;/FONT&gt;" &amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Consolas&gt;&lt;FONT color=#ff0000&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR&gt;createSilverlight();&lt;BR&gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;BR&gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;lt;/body&amp;gt;&lt;BR&gt;&amp;lt;/html&amp;gt;&lt;/FONT&gt; 
&lt;P&gt;This is a very simple test page and there are only a few tags which we care about on this page.&amp;nbsp; The first is the two script tags which point to Silverlight.js and TestPage.html.js.&amp;nbsp; The first is a file we will include in every Silverlight application we write.&amp;nbsp; It contains functions to detect if Silverlight is installed and give us information about version.&amp;nbsp; It also contains two functions createObject() and createObjectEx() which we will call create the Silverlight plugin on our page.&lt;/P&gt;
&lt;P&gt;The other part of this page which is important to note is the call createSilverlight(); which is calling a method in TestPage.html.js.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Silverlight.js and TestPage.html.js&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now open TestPage.html.js from the Solution Explorer.&amp;nbsp; You might have to expand the TestPage.html file by clicking on the plus symbol. Below is the code listing from TestPage.html.js:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;function createSilverlight()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sys.Silverlight.createObjectEx({&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; source: "&lt;FONT color=#ff0000&gt;Page.xaml&lt;/FONT&gt;",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; parentElement: document.getElementById("&lt;FONT color=#008000&gt;SilverlightControlHost&lt;/FONT&gt;"),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: "SilverlightControl",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties: {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: "100%",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height: "100%",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; version: "0.95",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enableHtmlAccess: true&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; events: {}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As you can see the only function in the JavaScript file is createSilverlight().&amp;nbsp; This function is just calling a function Sys.Silverlight.createobjectEx() which is found in the Silverlight.js file.&amp;nbsp; The two important items to note for now are the source paramter which is set to Page.xaml and the parentElement parameter which is being set to the result of document.getElementById("SilverlightControlHost").&amp;nbsp;&amp;nbsp;It is important to make sure that the name passed into getElementById here matches the id of our div in our html file.&amp;nbsp; Both are highlighted in green above.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Page.xaml file is the name of the file where all our XAML exists. This is the first page which the Silverlight plugin will load after the call to createObjectEx.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;XAML&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Xaml (extensible Application Markup Language)&amp;nbsp;is an XML language which&amp;nbsp;describes our user interface. Open the Page.xaml file by double clicking on it in the Solution Explorer.&amp;nbsp; Below is the Xaml in Page.xaml:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&amp;lt;Canvas x:Name="parentCanvas"&lt;BR&gt;xmlns="&lt;/FONT&gt;&lt;A href="http://schemas.microsoft.com/client/2007%22" mce_href='http://schemas.microsoft.com/client/2007"'&gt;&lt;FONT face=Consolas&gt;http://schemas.microsoft.com/client/2007"&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Consolas&gt;xmlns:x="&lt;/FONT&gt;&lt;A href="http://schemas.microsoft.com/winfx/2006/xaml%22" mce_href='http://schemas.microsoft.com/winfx/2006/xaml"'&gt;&lt;FONT face=Consolas&gt;http://schemas.microsoft.com/winfx/2006/xaml"&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Consolas&gt;&lt;FONT color=#ff0000&gt;Loaded="Page_Loaded"&lt;/FONT&gt; &lt;BR&gt;&lt;FONT color=#ff0000&gt;x:Class="ManagedSilverlight101.Page;assembly=ClientBin/ManagedSilverlight101.dll"&lt;BR&gt;&lt;/FONT&gt;Width="640"&lt;BR&gt;Height="480"&lt;BR&gt;Background="White"&lt;BR&gt;&amp;gt; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&amp;lt;/Canvas&amp;gt;&lt;/FONT&gt; 
&lt;P&gt;We have a single element a Canvas which&amp;nbsp;has a width of&amp;nbsp;640&amp;nbsp;and a height of&amp;nbsp;480. There are two important attributes to observer in the Xaml.&amp;nbsp; The first is the Loaded attribute which simply sets the Loaded event to a method called Page_Loaded.&amp;nbsp; 
&lt;P&gt;The second attribute and the one that says we are using .NET vs. JavaScript is the x:Class attribute.&amp;nbsp; Let's break apart the the statement that is being assigned to x:Class.&amp;nbsp; 
&lt;P&gt;&lt;EM&gt;ManagedSilverlight101.Page&lt;/EM&gt; specifies that the class we want to load is called Page which is in the ManagedSilverlight101 namespace. We will look at the code in a minute.&amp;nbsp; 
&lt;P&gt;&lt;EM&gt;assembly=ClientBin/ManagedSilverlight101.dll&lt;/EM&gt; says that the Page class in the namespace ManagedSilverlight101 is stored in the ManagedSilverlight101.dll which is located in a relative directory called ClientBin. 
&lt;P&gt;As a review a dll is just a file which stores code.&amp;nbsp; However instead of storing it as text the compiler&amp;nbsp;has&amp;nbsp;transformed&amp;nbsp;the code into an intermediate language called MSIL (Microsoft Intermediate Language).&amp;nbsp; The reason we&amp;nbsp;compile&amp;nbsp;the code is so that we can guarantee the programmer didn't make any typing mistakes while writing the program.&amp;nbsp; In .NET we call the dll files assemblies. 
&lt;P&gt;For those familiar with WPF a big difference between Silverlight and WPF is that Xaml is never compiled, only our .NET code gets compiled.&amp;nbsp; However we may still store the Xaml as an embedded resource in the dll. 
&lt;P&gt;&lt;STRONG&gt;.NET Code&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now open the Page.xaml.cs file from the solution explorer.&amp;nbsp; You might have to expand Page.xaml by clicking on the plus sign to find the Page.xaml.cs file below it. Here is the code from the Page.xaml.cs file:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;using System;&lt;BR&gt;using System.Windows;&lt;BR&gt;using System.Windows.Controls;&lt;BR&gt;using System.Windows.Documents;&lt;BR&gt;using System.Windows.Ink;&lt;BR&gt;using System.Windows.Input;&lt;BR&gt;using System.Windows.Media;&lt;BR&gt;using System.Windows.Media.Animation;&lt;BR&gt;using System.Windows.Shapes; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;namespace ManagedSilverlight101&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public partial class Page : Canvas&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Page_Loaded(object o, EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Required to initialize variables&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt; 
&lt;P&gt;All of the code above is written in the language C# which has very similar syntax to JavaScript. I am not going to go into the details of C# here, but I will cover enough to explain what is happening in our small program. I have&amp;nbsp;intentionally&amp;nbsp;left out details to make understanding simpler.&amp;nbsp;I would suggest picking up a good C# book if you are interested in learning more about the language or pickup a book on your favorite .NET language.&amp;nbsp; There is a new JavaScript implementation that the DLR (Dynamic Language Runtime)&amp;nbsp;team is working on which can also be used to write .NET programs.&lt;/P&gt;
&lt;P&gt;At the top of the code we have nine lines which all start with the word&amp;nbsp;"using" followed by something like System.Windows.Ink.&amp;nbsp; These statements are just saying that we want to use the classes in those namespaces. Namespaces allow us to scope classes, methods and variables. It is very similar to using a script tag to import other JavaScript files that you are using, except that we don't have to import everything defined in the file, only the parts we care about.&lt;/P&gt;
&lt;P&gt;Then we have lines of code like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;namespace ManagedSilverlight101&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This simple says that we want to create all the code contained in the curly braces in the ManagedSilverlight101 namespace. &lt;/P&gt;
&lt;P&gt;Next we have the lines:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;public partial class Page : Canvas&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Here we are creating a new class named&amp;nbsp;Page which derives from the class Canvas.&amp;nbsp; This means our Page class will take on all the properties, methods, fields and events of the Canvas class and then we can add new behavior and data to the Page class to make it do what we want. Classes are similar to JavaScript prototypes. &lt;/P&gt;
&lt;P&gt;Now we have the lines:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;public void Page_Loaded(object o, EventArgs e)&lt;BR&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;With this line we are defining a function called Page_Loaded that takes two parameters.&amp;nbsp; C# requires parameters to be typed.&amp;nbsp;The first parameter is called o and is of Type object.&amp;nbsp; object is the base type of every other type in .NET so any type could be passed into the Page_loaded function.&amp;nbsp; The second parameter is called e and is of type EventArgs. &lt;/P&gt;
&lt;P&gt;The Page_Loaded function is actually an event handler.&amp;nbsp; If you remember that in our Xaml we defined an event handler for the Loaded event to be "Page_Loaded". &lt;/P&gt;
&lt;P&gt;The final part of our small program is:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;InitializeComponent();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&lt;FONT face=ve&gt;&lt;FONT face=Verdana&gt;This is just a call to the function InitalizeComponents(). Currently this method doesn't do anything, but if you put the cursor on the method and right click you will get a context menu.&amp;nbsp; Then choose "Go To Definition" and Visual Studio will open a new file.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B1%5D.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B1%5D.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=169 src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;&lt;FONT face=Verdana&gt;The file is called Page.g.cs and is generated by Visual Studio on our behalf.&amp;nbsp; Here are the contents of the file:&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Consolas&gt;&lt;/P&gt;
&lt;P&gt;using System;&lt;BR&gt;using System.Windows;&lt;BR&gt;using System.Windows.Controls;&lt;BR&gt;using System.Windows.Documents;&lt;BR&gt;using System.Windows.Ink;&lt;BR&gt;using System.Windows.Input;&lt;BR&gt;using System.Windows.Media;&lt;BR&gt;using System.Windows.Media.Animation;&lt;BR&gt;using System.Windows.Shapes; 
&lt;P&gt;namespace ManagedSilverlight101 &lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public partial class Page&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // variable declarations&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void InitializeComponent()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;} 
&lt;P&gt;&lt;FONT face=Verdana&gt;As you can see this looks very similar to our class defined in Page.xaml.cs. In fact it has the same namespace and class name.&amp;nbsp; This is because it is actually the same class we were defining in the Page.xaml.cs file, except that there is an additional function declared called InitializeComponent(). The partial keyword before the class keyword tells the compiler that we want to extend the other class we are defining in another file, not create a new class. Partial classes are owned by the designer (which we don't yet have with Silverlight) and by the compiler when we update our xaml file.&amp;nbsp;It is a place where generated code can be&amp;nbsp;put without&amp;nbsp;messing up code written by programmers.&amp;nbsp; Most of the time we aren't going to need to look at this file and we will almost never have to edit it, so close that tab by clicking on the X at the top,&amp;nbsp;right of the tab page. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;FONT face=Verdana&gt;Creating Visual Elements with Code&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Now that we have a grasp of what Visual Studio created for us we can start writing code.&amp;nbsp; So switch or open the file Page.xaml.cs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;STRONG&gt;Xaml to .NET&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;After the Page_Loaded function definition we are going to add a property to hold the root element of our Xaml file. Start by typing in lowercase:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;prop&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;And then hit TAB twice.&amp;nbsp; The first time closes the intellesense that popped up when we typed prop and the second time will create a code snippet for us. Notice that the work int is highlighted with a blue background:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B3%5D.png" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B3%5D.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=240 src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B2%5D.png" width=209 border=0 mce_src="http://blogs.msdn.com/blogfiles/ebooth/WindowsLiveWriter/Sil.NETintroductionforJavaScriptDevelope_CA8B/image%7B0%7D%5B2%5D.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Now type the word&amp;nbsp;Canvas with the uppercase C.&amp;nbsp; C# like JavaScript is&amp;nbsp;a type sensitive language.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Press the TAB key twice again and myVar will become highlighted in blue. &lt;/FONT&gt;&lt;FONT face=Verdana&gt;Notice that when you hit TAB that&amp;nbsp;Canvas changed not only where you typed it but also before the work MyProperty. Now we will finish off the property by naming it:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Type: parentCanvas&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Press TAB once:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Type: ParentCanvas&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Press: Enter&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;When you hit Enter your cursor will be placed after the property we just created.&amp;nbsp; It should be defined like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;private Canvas parentCanvas; &lt;/P&gt;
&lt;P&gt;public Canvas ParentCanvas&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return parentCanvas; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { parentCanvas = value; }&lt;BR&gt;} 
&lt;P&gt;&lt;FONT face=Verdana&gt;Now that we have a property to hold our root Xaml element we need to pull the element out of the Xaml and assign it to our new property. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;NOTE: In WPF the compiler generates properties for any element you name in Xaml.&amp;nbsp; Currently you must create and&amp;nbsp;wire up the properties yourself. &lt;/EM&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;In the Page_Loaded function after the InitializeComponent function call add the line:&lt;/FONT&gt; 
&lt;P&gt;parentCanvas = (Canvas)FindName("parentCanvas"); 
&lt;P&gt;&lt;FONT face=Verdana&gt;This line of code calls the FindName method passing&amp;nbsp;the name&amp;nbsp;of the&amp;nbsp;root element in the xaml file.&amp;nbsp; In this case we named our property the same as what we named the root element.&amp;nbsp; This is not required but is a good practice. Then it assigns the result to the parentCanvas field we created when we defined the ParentCanvas property.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Because .NET is typesafe we need to add (Canvas) just before the FindName function.&amp;nbsp; This bit of code casts what is returned from FindName to the type Canvas. FindName is defined in the class&amp;nbsp;DependencyObject to return the type DependencyObject. DependencyObject is the base type for most everything in Silverlight&amp;nbsp;including the Canvas we declared in our Xaml file, so we are able to cast&amp;nbsp;back to Canvas.&lt;/FONT&gt; 
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Verdana&gt;This&lt;/FONT&gt;&lt;/STRONG&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Now that we know how to use FindName I am going to introduce a great shortcut.&amp;nbsp; We don't actually need to call FindName most of the time. The compiler and framework will take care of creating the properties for us.&amp;nbsp; Remove the lines:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana&gt;
&lt;P&gt;private Canvas parentCanvas; &lt;/P&gt;
&lt;P&gt;public Canvas ParentCanvas&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return parentCanvas; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { parentCanvas = value; }&lt;BR&gt;} &lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;parentCanvas = (Canvas)FindName("parentCanvas"); &lt;/P&gt;
&lt;P&gt;We instead are going to access the parentCanvas through the keywork this.&amp;nbsp;&amp;nbsp;By&amp;nbsp;placing the x:Class tag&amp;nbsp;in our xaml page&amp;nbsp;we told the compiler that we wanted it to link that xaml snippet to our&amp;nbsp;class.&amp;nbsp; "this" meaning the current object we are dealing with.&amp;nbsp; In this case&amp;nbsp;the Canvas that is our root element on our xaml file. So this is evaluates to&amp;nbsp;true:&lt;/P&gt;
&lt;P&gt;this == (Canvas)FindName("parentCanvas"); &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Now we can start manipulating the parentCanvas by changing it's properties and adding children.&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;STRONG&gt;Manipulating Properties&lt;/STRONG&gt;&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;The first place to start exploring is to play with the properties of our parentCanvas. We will start by changing the background brush. Where we had:&lt;/FONT&gt; 
&lt;P&gt;parentCanvas = (Canvas)FindName("parentCanvas"); 
&lt;P&gt;&lt;FONT face=Verdana&gt;Put this line:&lt;/FONT&gt; 
&lt;P&gt;this.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); 
&lt;P&gt;&lt;FONT face=Verdana&gt;The line of code above sets the Background of our Canvas to the SolidColor Red. We start by creating a new SolidColorBrush and pass the color we want to assign in the constructor.&amp;nbsp; To pass the color we are using the Color classes static method FromRgb. Which takes three arguments of red, green and blue values which range from 0 to 255. In this case we are getting the red color.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;We also can access the colors through named colors like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;this.Background = new SolidColorBrush(Colors.Red)); &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Now that we have added that we should run our project to see our result.&amp;nbsp; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Press: CRTL+F5 &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;The project will build and then open the default browser to display our Silverlight application. If something was mistyped you will get build errors. While errors can be frustrating to fix they are a lot more convenient then discovering the issues at runtime.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;STRONG&gt;Adding Children&lt;/STRONG&gt;&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;For the finaly we will add children to our parentCanvas programmatically. We are going to add an Ellipse that has a gradient brush that fades from Blue to Green.&amp;nbsp; We are going to put this on the line after:&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT size=+0&gt;this.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Here is the code listing:&lt;/FONT&gt; 
&lt;P&gt;Ellipse childShape = new Ellipse(); 
&lt;P&gt;childShape.Width = 100;&lt;BR&gt;childShape.Height = 100; 
&lt;P&gt;LinearGradientBrush lgb = new LinearGradientBrush(); 
&lt;P&gt;GradientStop gs1 = new GradientStop();&lt;BR&gt;gs1.Color = Color.FromRgb(0, 0, 255);&lt;BR&gt;lgb.GradientStops.Add(gs1); 
&lt;P&gt;GradientStop gs2 = new GradientStop();&lt;BR&gt;gs2.Color = Color.FromRgb(0, 255, 0);&lt;BR&gt;gs2.Offset = 1;&lt;BR&gt;lgb.GradientStops.Add(gs2); 
&lt;P&gt;childShape.Fill = lgb; 
&lt;P&gt;this.Children.Add(childShape); 
&lt;P&gt;&lt;FONT face=Verdana&gt;Let's breakdown what is happening here as it is a lot of code. To start we are creating an Ellipse called childShape.&amp;nbsp; Then we are setting withe Width and Height to 100.&amp;nbsp; Next we create the LinearGradientBrush called lgb that we are going to paint our Ellipse with.&amp;nbsp; We great two GradientStop objects and set there Color and Offset properties. This should look very similar to what we did above except that we aren't using a SolidColorBrush.&amp;nbsp; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;We have a line after each of our GradientStop declarations that looks like this:&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;lgb.GradientStops.Add(gs1); &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Here we are adding the gradient stop to the linear gradient brush we defined as lgb.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Then we assign the ChildShape's Fill property our linear gradient brush we just created.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Lastly we call:&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;this.parentCanvas.Children.Add(childShape);&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;Which adds our ellipse to the Children collection of the parentCanvas.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;/FONT&gt;
&lt;H1&gt;&lt;FONT face=Verdana&gt;Conclusions&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;We have covered a lot of information in this post, but it is a great foundation for writing future applications.&amp;nbsp; In my next post I will show how the new features of C# 3.0 can make this code a lot simpler.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2488993" width="1" height="1"&gt;</description></item><item><title>MIX 07 Sessions Online</title><link>http://blogs.msdn.com/b/ebooth/archive/2007/05/03/mix-07-sessions-online.aspx</link><pubDate>Thu, 03 May 2007 06:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2385795</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=2385795</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2007/05/03/mix-07-sessions-online.aspx#comments</comments><description>&lt;P&gt;This week we launched Silverlight at MIX07 and now all the sessions are online at &lt;A href="http://sessions.visitmix.com/" mce_href="http://sessions.visitmix.com/"&gt;sessions.visitmix.com&lt;/A&gt;.&amp;nbsp; I am watching a great session on LINQ and Silverlight presented by Anders Hejlsberg. LINQ is only one part of the announcements we made this week at MIX.&amp;nbsp; We also announced that we have support for .NET with Silverlight. I have been waiting for this announcement for some time as I am much more of a .NET programmer then JavaScript.&amp;nbsp; Over the next few months I will transform my blog to concentrate on Silverlight with .NET.&amp;nbsp;&amp;nbsp;&amp;nbsp;At the end of the May I will be presenting in Italy and Sweden on Silverlight and .NET, but more about that later. &lt;/P&gt;
&lt;P&gt;It is important to understand the different versions of Silverlight currently available:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/vstudio/eula.aspx?id=fbc0ab04-4ad9-664d-07f4-d4592dd8e157"&gt;Silverlight 1.0 Beta&lt;/A&gt;:&lt;/STRONG&gt;&amp;nbsp;At MIX the Silverlight Beta 1.0 was released.&amp;nbsp; It contains support for JavaScript based programming.&amp;nbsp; While I will not be spending a lot of time writing about that here I will be covering a lot of the same APIs.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/vstudio/eula.aspx?id=e2c1a44f-0b5c-face-28c8-08a26f2e0b3c"&gt;Silverlight 1.1 Alpha&lt;/A&gt;:&lt;/STRONG&gt; At MIX we also released the Silverlight Alpha 1.1.&amp;nbsp; This version supports both JavaScript based programming and .NET.&amp;nbsp; Additionally it supports the DLR (Dynamic Language Runtime).&amp;nbsp; Being a language geek I will be spending some time talking about Iron Ruby and Iron Python. In order to follow the samples on my blog for Silverlight you will need the 1.1 Alpha plugin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;All the bits, samples, video tutorials, and more can be found on &lt;A href="http://silverlight.net/Default.aspx"&gt;Silverlight.net&lt;/A&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2385795" width="1" height="1"&gt;</description></item><item><title>XNA On Channel9</title><link>http://blogs.msdn.com/b/ebooth/archive/2006/09/11/749744.aspx</link><pubDate>Mon, 11 Sep 2006 21:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:749744</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=749744</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2006/09/11/749744.aspx#comments</comments><description>&lt;P&gt;A few weeks ago I headed over to &lt;A href="http://www.microsoftgamefest.com/"&gt;Gamefest&lt;/A&gt;&amp;nbsp;when XNA Express&amp;nbsp;was announced to shoot a Channel9 video with the team.&amp;nbsp; &lt;A href="http://channel9.msdn.com/Showpost.aspx?postid=233947"&gt;Check it out&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;For those of you not familiar with XNA Express it allows developers to write games using C# and play them on Xbox 360 and Windows.&amp;nbsp; XNA is built on top of DirectX 9 and makes writing games a lot easier.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=749744" width="1" height="1"&gt;</description></item><item><title>Peer To Peer in Windows Vista - Part 2 - PNRP</title><link>http://blogs.msdn.com/b/ebooth/archive/2006/09/08/746884.aspx</link><pubDate>Sat, 09 Sep 2006 00:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:746884</guid><dc:creator>MSDNArchive</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ebooth/rsscomments.aspx?WeblogPostID=746884</wfw:commentRss><comments>http://blogs.msdn.com/b/ebooth/archive/2006/09/08/746884.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;Today we are going to look at a few different methods.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The first set of methods allows us to register a PNRP name and the next set of methods allows us to resolve a PNRP name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A few important things to keep in mind are that the Windows Firewall Client will block traffic so this code will not work between machines unless we add and exception to the Windows Firewall client.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For now you can manually add the exception or work between two instances running on the same machine. PNRP will not resolve a name registered in the same process, so you need to run two separate instances to make PNRP work.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We will come back to the Windows Firewall problem in a feature post when we look at those APIs. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri&gt;In my last post I talked about the libs and header files required to compile so reference that post if you are having problems.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri&gt;Most of the peer to peer APIs are exposed as native Win32 libraries.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This means we either have to use PINVOKE or write a C++\CLI 2005 wrapper.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I have chosen to write a wrapper, because the peer to peer APIs require special methods to release the memory from the structures they create.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you are new to writing interop code you should get a copy of “.Net and Com The Complete Interoperability Guide” by Adam Nathan. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri&gt;For a deep understanding of how PNRP works under the covers check out this &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/p2pintro.mspx"&gt;&lt;FONT face=Calibri&gt;article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Here is the code for the register method. We begin by looking a method that allows us to register a PNRP name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;PNRP is a “DNS-like” protocol accept that it is server-less.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Something to keep in mind is I have removed all error checking from this sample to make it easier to understand.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;HRESULT P2PCom::Peer::PnrpRegister(PWSTR pwzName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ULONG&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;cAddresses = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HRESULT&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = S_OK;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Address locals&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ULONG pcAddresses =&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PEER_PNRP_AUTO_ADDRESSES;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PWSTR pwzPeerName =&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;NULL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PEER_PNRP_REGISTRATION_INFO info;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HANDLE registration; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ZeroMemory(&amp;amp;info, &lt;SPAN style="COLOR: blue"&gt;sizeof&lt;/SPAN&gt;(PEER_PNRP_REGISTRATION_INFO));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Create the peer name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = PeerCreatePeerName(NULL, pwzName, &amp;amp;pwzPeerName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Comment style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Courier New" color=#008000 size=2&gt;// We need the cloudName and address to register the PNRP name.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;info.pwzCloudName = L&lt;SPAN style="COLOR: maroon"&gt;"Global_"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;info.cAddresses = pcAddresses;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Comment style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// Register the PNRP name in the cloud.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = PeerPnrpRegister(pwzPeerName, &amp;amp;info, &amp;amp;registration);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Comment style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Courier New" color=#008000 size=2&gt;// Clean up&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PeerFreeData(pwzPeerName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; hr;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;Breaking down the PnrpRegister method we first call the &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerCreatePeerName&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; function which creates a PNRP name from the string that is passed into the method.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We passed NULL to the first method because we want to create an unsecured PNRP name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If we wanted to have a secured name then we would have to pass the results from a call to &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerIdentityCreate&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; fuction.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The article I pointed to earlier will explain the difference between secured and unsecured PNRP names in detail, but basically an unsecure name is not unique a secured name is unique. We passed Ernie into this method we would get 0.Ernie as a result of the call to &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerCreatePeerName&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;. The zero dot in front of Ernie means this is an unsecured peername a secured PNRP name would have a long hash of a public key infront of it. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;Next we assign the name of the cloud we want to register the PNRP name in to a &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PEER_PNRP_REGISTRATION_INFO&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; structure called &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;info&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this case we are registering in the global cloud which means the internet.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are other options for clouds shown in the table below from the Windows SDK:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE class=MsoNormalTable style="BACKGROUND: #999999; MARGIN: auto auto auto 0.5in; WIDTH: 90%; mso-cellspacing: 1.5pt" cellPadding=0 width="90%" border=0&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: #cccccc; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=bottom&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: #cccccc; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=bottom&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Meaning&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 1"&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 40%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="40%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;PNRP_SCOPE_ANY&lt;BR&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 60%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="60%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;All IP addresses are allowed to register with the PNRP cloud.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 2"&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 40%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="40%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;PNRP_GLOBAL_SCOPE&lt;BR&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 60%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="60%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The scope is global; all valid IP addresses are allowed to register with the PNRP cloud.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 3"&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 40%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="40%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;PNRP_SITE_LOCAL_SCOPE&lt;BR&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 60%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="60%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The scope is site-local; only IP addresses defined for the site are allowed to register with the PNRP cloud.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 4; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 40%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="40%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;PNRP_LINK_LOCAL_SCOPE&lt;BR&gt;3&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 6pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 6pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #f0f0f0; WIDTH: 60%; PADDING-TOP: 3pt; BORDER-BOTTOM: #f0f0f0" vAlign=top width="60%"&gt;
&lt;P class=MsoNormal style="MARGIN: 0.1in 0in 0.05in"&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The scope is link-local; only IP addresses defined for the local area network are allowed to register with the PNRP cloud.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;The other field of the structure we specifiy is &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;cAddresses&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; which we set to &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PEER_PNRP_AUTO_ADDRESSES&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;. This tells &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerPnrpRegister&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; how to bind our PNRP name to our IP address.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Last we call &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerPnrpRegister&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; which actually does the PNRP name registration.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;The method below is the .NET wrapper method to expose the native method we just looked at.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It simply marshals the name that is passed in and calls the native &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PnrpRegister&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;void&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; P2PCom::Peer::RegisterName(System::String ^name)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;System::IntPtr ^piName = Marshal::StringToBSTR(name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PWSTR pName = (PWSTR)piName-&amp;gt;ToPointer();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PnrpRegister(pName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Marshal::FreeBSTR(*piName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-no-proof: yes"&gt;Now that we have registered a name we need to resolve the name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;IMPORTANT:&lt;/B&gt; you cannot resolve a PNRP name register in the same process you are doing the resolve in, this is a big gotchya when first developing with this API. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Take a look at the source code listing then we discuss what is happening here.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;IPAddress ^P2PCom::Peer::ResolvePeerNameCommand(PCWSTR pwzName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HRESULT&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = S_OK;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PPEER_PNRP_ENDPOINT_INFO pEndpointInfo = NULL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;ULONG&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;cEndpoints = MAX_ENDPOINTS_TO_RESOLVE;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Perform a synchronous resolve&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = PeerPnrpResolve(pwzName, L&lt;SPAN style="COLOR: maroon"&gt;"Global_"&lt;/SPAN&gt;, &amp;amp;cEndpoints, &amp;amp;pEndpointInfo);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(pEndpointInfo == NULL)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; IPAddress::None;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;WCHAR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;wzAddr[MAX_PEERNAME_LENGTH];&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Display associated addresses&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = 0; i &amp;lt; pEndpointInfo-&amp;gt;cAddresses; i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DWORD dwLen = (&lt;SPAN style="COLOR: blue"&gt;sizeof&lt;/SPAN&gt;(wzAddr) / &lt;SPAN style="COLOR: blue"&gt;sizeof&lt;/SPAN&gt;(wzAddr[0]));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Make sure the address is IPv6&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;(pEndpointInfo-&amp;gt;ppAddresses[i]-&amp;gt;sa_family == AF_INET6)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hr = WSAAddressToString(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(LPSOCKADDR) pEndpointInfo-&amp;gt;ppAddresses[i],&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;sizeof&lt;/SPAN&gt;(SOCKADDR_IN6), NULL, wzAddr, &amp;amp;dwLen);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Comment style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;FONT face="Courier New" color=#008000 size=2&gt;// Release resources. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerFreeData(pEndpointInfo);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IPAddress ^ip = IPAddress::Parse(&lt;SPAN style="COLOR: blue"&gt;gcnew&lt;/SPAN&gt; System::String(wzAddr));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; ip;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;We only make one P2P PNRP API call in this method to &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;PeerPnrpResolve&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; which attempts to do a sycronous resolve of the method.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are also async versions of this method which make sense to use in GUI applications as this method can takes a few seconds to return. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;It will return all the pnrp end points it found in the &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;pEndpointInfo&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; argument. That is end points plural because I could register the same end point at work, home and on my laptop, also with unsecure names there will likely be other people with the same end point name as mine. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;Next check to see if we received any end points and then loop through all the end points we received.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We only care about those addresses that are IPv6 for this sample.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Change the last endpoint into a string and save it in the &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;wzAddr&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt; variable using a WinSock helper method. Then we create a managed IPAddress by calling it’s Parse method on the address string.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-no-proof: yes"&gt;Last thing is to write a wrapper method so that .NET applications can call this method. &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;System::Net::IPAddress ^P2PCom::Peer::ResolveName(System::String ^name)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;System::IntPtr ^piName = Marshal::StringToBSTR(name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PWSTR pName = (PWSTR)piName-&amp;gt;ToPointer();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IPAddress ^ip = ResolvePeerNameCommand((PWSTR)pName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Marshal::FreeBSTR(*piName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; ip;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;In my full class I move all the start up an shutdown code to my constructor and destructor as shown here:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;P2PCom::Peer::Peer()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PeerPnrpStartup(PNRP_VERSION);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;P2PCom::Peer::~Peer()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PeerPnrpShutdown();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;There is a lot more to PNRP and there is a great sample in the SDK located here:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;“C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\NetDs\PeerToPeer\PNRP”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=746884" width="1" height="1"&gt;</description></item></channel></rss>