<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.eisoft.com/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>.NET</title><link>http://community.eisoft.com/blogs/.net/default.aspx</link><description>.NET Development, IDE Tools</description><dc:language>en-US</dc:language><generator>CommunityServer 2.0 (Build: 60210.2610)</generator><item><title>FireFox 3.0 Will Support Microsoft CardSpace</title><link>http://community.eisoft.com/blogs/.net/archive/2007/07/11/795.aspx</link><pubDate>Wed, 11 Jul 2007 22:11:37 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:795</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/795.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=795</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/795.aspx</wfw:comment><description>&lt;p&gt;That is great news as Microsoft and FireFox are really starting to work together:&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/richardt/archive/2007/07/11/firefox-3-0-likely-to-support-windows-cardspace.aspx"&gt;View article...&lt;/a&gt;&lt;/p&gt; &lt;p&gt;SM&lt;/p&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=795" width="1" height="1"&gt;</description></item><item><title>Sweet App</title><link>http://community.eisoft.com/blogs/.net/archive/2007/07/10/791.aspx</link><pubDate>Tue, 10 Jul 2007 18:31:37 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:791</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/791.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=791</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/791.aspx</wfw:comment><description>&lt;p&gt;Control your Windows Mobile Device from your PC.&amp;nbsp; I have been looking for something like this for quite some time and it is finally here:&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.mymobiler.com/" href="http://www.mymobiler.com/"&gt;http://www.mymobiler.com/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;SM&lt;/p&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=791" width="1" height="1"&gt;</description></item><item><title>&amp;quot;One Millionnnn Dolllarrs....&amp;quot;</title><link>http://community.eisoft.com/blogs/.net/archive/2007/07/10/790.aspx</link><pubDate>Tue, 10 Jul 2007 08:41:28 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:790</guid><dc:creator>Shaun</dc:creator><slash:comments>1</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/790.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=790</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/790.aspx</wfw:comment><description>&lt;p&gt;&lt;a href="http://www.eisoft.com/images/OneMillionnnnDolllarrs_14C68/DrEvil1.jpg"&gt;&lt;img height="240" src="http://www.eisoft.com/images/OneMillionnnnDolllarrs_14C68/DrEvil.jpg" width="180" border="0"&gt;&lt;/a&gt; &lt;a href="http://www.eisoft.com/images/OneMillionnnnDolllarrs_14C68/jakob_stripes_big1.jpg"&gt;&lt;img height="159" src="http://www.eisoft.com/images/OneMillionnnnDolllarrs_14C68/jakob_stripes_big.jpg" width="240" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=790" width="1" height="1"&gt;</description></item><item><title>Microsoft LifeCam Drivers Now Available for Windows Vista (32 and 64 bit)</title><link>http://community.eisoft.com/blogs/.net/archive/2007/01/24/784.aspx</link><pubDate>Wed, 24 Jan 2007 17:58:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:784</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/784.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=784</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/784.aspx</wfw:comment><description>&lt;P&gt;After a long wait period, the Microsoft LifeCam drivers are now available for Windows Vista including both 32-bit and 64-bit platforms.&amp;nbsp; You can get them here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.microsoft.com/hardware/windowsvista/support.mspx"&gt;http://www.microsoft.com/hardware/windowsvista/support.mspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;All of my hardware is now officially supported by Windows Vista.&amp;nbsp; Nice.&lt;/P&gt;
&lt;P&gt;SM&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=784" width="1" height="1"&gt;</description></item><item><title>Blogging for the Orlando Sentinel</title><link>http://community.eisoft.com/blogs/.net/archive/2007/01/11/782.aspx</link><pubDate>Thu, 11 Jan 2007 20:17:05 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:782</guid><dc:creator>Shaun</dc:creator><slash:comments>2</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/782.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=782</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/782.aspx</wfw:comment><description>&lt;p&gt;For those interested in reading things outside of programming and software architecture, I have started blogging for the Orlando Sentinel.&amp;nbsp; You can read the posts here:&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.orlandosentinel.com/community_apopka_blog/2007/01/of_mice_and_men.html" target="_blank"&gt;Orlando Sentinel Apopka Community&lt;/a&gt;&lt;/p&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=782" width="1" height="1"&gt;</description></item><item><title>DVD+-RW / DVD-RW stops working or loses functionality in Windows Vista.</title><link>http://community.eisoft.com/blogs/.net/archive/2007/01/10/iTunesVistaClash.aspx</link><pubDate>Wed, 10 Jan 2007 09:15:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:780</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/780.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=780</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/780.aspx</wfw:comment><description>&lt;P&gt;I recently purchased a nice new Dell for my wife as her Christmas present.&amp;nbsp; I installed Windows Vista Ultimate as the OS and everything was working great.&amp;nbsp; Then, I realized that the TsstCorp DVD+-RW drive that came with the system was not being correctly recognized and only had functionality as a CD-ROM Drive.&lt;/P&gt;
&lt;P&gt;That was very annoying.&lt;/P&gt;
&lt;P&gt;After much research and attempting to delete UpperFilters/LowerFilters/AirFilters/VoiceFilters or whatever, I decided to look at what had been installed on the system since the original installation of Vista.&lt;/P&gt;
&lt;P&gt;The culpit -- iTunes.&lt;/P&gt;
&lt;P&gt;It turns out that Apple iTunes has its own CD/DVD Burning engine that comes with the entire package.&amp;nbsp; This engine is not yet compatible with Windows Vista but the great people at Apple say they will have updated and compatible Vista drivers when Microsoft launches the new OS in the retail sector.&lt;/P&gt;
&lt;P&gt;So, I uninstalled iTunes and all of a sudden my TsstCorp DVD+-RW drive was back.&lt;/P&gt;
&lt;P&gt;Annoying.&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=780" width="1" height="1"&gt;</description></item><item><title>Irena Kennedy:  Tool Goddess</title><link>http://community.eisoft.com/blogs/.net/archive/2006/10/29/264.aspx</link><pubDate>Mon, 30 Oct 2006 06:25:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:264</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/264.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=264</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/264.aspx</wfw:comment><description>&lt;P&gt;I am a regular vistor of Irena Kennedy's blog 'Something You Should Know"&lt;/P&gt;
&lt;P&gt;She knows to make the tools work for us.&amp;nbsp; Check out her latest article:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/irenak/archive/2006/10/27/sysk-228-get-table-columns-or-rows-with-single-key-press.aspx"&gt;http://blogs.msdn.com/irenak/archive/2006/10/27/sysk-228-get-table-columns-or-rows-with-single-key-press.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=264" width="1" height="1"&gt;</description></item><item><title>One Set of Footprints in Your App</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/31/63.aspx</link><pubDate>Fri, 01 Sep 2006 00:30:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:63</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/63.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=63</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/63.aspx</wfw:comment><description>&lt;P&gt;Irena Kennedy has some interesting things to say about Sql Server 2005 Everywhere Edition and how "compact" it truly is.&amp;nbsp; The footprint is larger than you think:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/irenak/archive/2006/08/31/733527.aspx"&gt;http://blogs.msdn.com/irenak/archive/2006/08/31/733527.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;SM&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=63" width="1" height="1"&gt;</description></item><item><title>MsBuild: Custom Task: Drive Mapper</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/18/47.aspx</link><pubDate>Fri, 18 Aug 2006 19:03:43 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:47</guid><dc:creator>Shaun</dc:creator><slash:comments>4</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/47.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=47</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/47.aspx</wfw:comment><description>&lt;p&gt;For those not familiar with MsBuild, it is Microsoft's Build Engine that comes with the .NET 2.0 Framework.&amp;nbsp; It is a highly flexible and highly reusable framework that makes it possible to build almost any type of software and deploy any type of product.&amp;nbsp; Personally, I think it is an excellent tool.&lt;/p&gt; &lt;p&gt;One common task that I have wanted to perform in MsBuild is drive mapping.&amp;nbsp; If I could have a Custom MsBuild Task that would map a drive letter to a UNC path, I could deploy my application to anywhere within my subnet (testing, staging, and even production).&amp;nbsp; So, recently, I set out to create that Custom MsBuild Task and here are the results and the code that I wrote.&lt;/p&gt; &lt;p&gt;First off, in order to create an Custom MsBuild Task, you have to inherit from &lt;strong&gt;Microsoft.Build.Utilities.Task &lt;/strong&gt;and then implement the &lt;strong&gt;bool Execute() &lt;/strong&gt;member method required by the base class.&lt;/p&gt; &lt;p&gt;In order to use the Win32 functions that map and unmap drives.&amp;nbsp; We're going to have to use Platform Invoke (P/Invoke).&amp;nbsp; The three platform methods that I use are (click on the function will take you to its documentation):&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://windowssdk.msdn.microsoft.com/en-us/library/ms739056.aspx" target="_blank"&gt;WNetAddConnection2A&lt;/a&gt;  &lt;li&gt;&lt;a href="http://windowssdk.msdn.microsoft.com/en-us/library/ms739067.aspx"&gt;WNetCancelConnection2A&lt;/a&gt;  &lt;li&gt;&lt;a href="http://windowssdk.msdn.microsoft.com/en-us/library/ms679351.aspx" target="_blank"&gt;FormatMessage&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Take a look at my implementations of the above methods in C#&lt;/p&gt; &lt;p&gt;&lt;pre class="csharpcode"&gt; [DllImport(&lt;span class="str"&gt;"mpr.dll"&lt;/span&gt;)] 
 &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WNetAddConnection2A
 ( 
      [MarshalAs(UnmanagedType.LPArray)] NETRESOURCEA[] lpNetResource, 
      [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; lpPassword, 
      [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; UserName, &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags
 );&lt;/pre&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;[StructLayout(LayoutKind.Sequential)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;struct&lt;/span&gt; NETRESOURCEA
{
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwScope;
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwType;
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwDisplayType;
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwUsage;
     [MarshalAs(UnmanagedType.LPStr)]
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpLocalName;
     [MarshalAs(UnmanagedType.LPStr)]
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpRemoteName;
     [MarshalAs(UnmanagedType.LPStr)]
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpComment;
     [MarshalAs(UnmanagedType.LPStr)]
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpProvider;
     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ToString()
     {
         &lt;span class="kwrd"&gt;string&lt;/span&gt; str = &lt;span class="str"&gt;"LocalName: "&lt;/span&gt; + lpLocalName + &lt;span class="str"&gt;" RemoteName: "&lt;/span&gt; + lpRemoteName
         + &lt;span class="str"&gt;" Comment: "&lt;/span&gt; + lpComment + &lt;span class="str"&gt;" lpProvider: "&lt;/span&gt; + lpProvider;
         &lt;span class="kwrd"&gt;return&lt;/span&gt; (str);
     }
 } &lt;/pre&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;[DllImport(&lt;span class="str"&gt;"mpr.dll"&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WNetCancelConnection2A
(
   [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; lpName,
   &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags,
   &lt;span class="kwrd"&gt;bool&lt;/span&gt; fForce
);&lt;/pre&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;[DllImport(&lt;span class="str"&gt;"Kernel32.dll"&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; FormatMessage
(
   &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags,
   IntPtr lpSource,
   &lt;span class="kwrd"&gt;int&lt;/span&gt; dwMessageID,
   &lt;span class="kwrd"&gt;int&lt;/span&gt; dwLanguageID,
   StringBuilder lpBuffer,
   &lt;span class="kwrd"&gt;int&lt;/span&gt; nSize,
   IntPtr arguments
 ); &lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Together, all of these methods will do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Map a Drive 
&lt;li&gt;Unmap a Drive 
&lt;li&gt;Display an Error Message returned by the operating system if the map fails.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;Now that we have all of these methods in place, we need to create properties to be used within the MsBuild Xml file for our task.&amp;nbsp; Here is the code for those properties:&lt;/p&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; RemoveIfExists
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _RemoveIfExists;
            }
            set
            {
                _RemoveIfExists = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }


        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Path
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _Path;
            }
            set
            {
                _Path = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }

        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DriveLetter
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _DriveLetter;
            }
            set
            {
                _DriveLetter = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }&lt;/pre&gt;
&lt;p&gt;Then, we need to have some methods that will make calling the external methods above a little bit smoother:&lt;/p&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; MapDrive()
        { 
            NETRESOURCEA[] resources    = &lt;span class="kwrd"&gt;new&lt;/span&gt; NETRESOURCEA[1];
            resources[0]                = &lt;span class="kwrd"&gt;new&lt;/span&gt; NETRESOURCEA();
            resources[0].dwType = 1;
            &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags = 1;
            resources[0].lpLocalName = _DriveLetter;
            resources[0].lpRemoteName = _Path;
            resources[0].lpProvider = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = WNetAddConnection2A(resources, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;, dwFlags);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;
        }

        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; UnmapDrive()
        {
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = WNetCancelConnection2A(_DriveLetter, 0, &lt;span class="kwrd"&gt;true&lt;/span&gt;);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;
        }&lt;/pre&gt;
&lt;p&gt;Lastly, we need to implement the execute method because it is the method that will be executed by MsBuild:&lt;/p&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Execute()
        {
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = MapDrive();
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret3 = 0;
            &lt;span class="kwrd"&gt;bool&lt;/span&gt; success = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
            StringBuilder message = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
            &lt;span class="kwrd"&gt;int&lt;/span&gt; messageId = FormatMessage(4096, IntPtr.Zero, ret, 0, message, 500, IntPtr.Zero);
            Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret });
            Log.LogMessage(&lt;span class="str"&gt;"Mapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { message.ToString() });

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (ret == 85 &amp;amp;&amp;amp; RemoveIfExists)
            {
                &lt;span class="kwrd"&gt;int&lt;/span&gt; ret2 = UnmapDrive();
                StringBuilder unmapMessage = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
                FormatMessage(4096, IntPtr.Zero, ret2, 0, unmapMessage, 500, IntPtr.Zero);
                Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret2 });
                Log.LogMessage(&lt;span class="str"&gt;"Unmapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { unmapMessage.ToString() });

                ret3 = MapDrive();
                StringBuilder mapMessage = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
                &lt;span class="kwrd"&gt;int&lt;/span&gt; mapMessageId = FormatMessage(4096, IntPtr.Zero, ret3, 0, mapMessage, 500, IntPtr.Zero);
                Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret3 });
                Log.LogMessage(&lt;span class="str"&gt;"Second Mapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { mapMessage.ToString() });
                success = !(ret3 &amp;gt; 85);
            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt;
            {
                success = !(ret &amp;gt; 0);
            }

            &lt;span class="kwrd"&gt;return&lt;/span&gt; success;
           
        }&lt;/pre&gt;
&lt;p&gt;Here's a look at all of the code combined:&lt;/p&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Build.Utilities;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Build.Framework;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Runtime.InteropServices;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; ExcellenceInSoftware.MsBuild.Tasks
{
    [StructLayout(LayoutKind.Sequential)]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;struct&lt;/span&gt; NETRESOURCEA
    {
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwScope;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwType;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwDisplayType;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; dwUsage;
        [MarshalAs(UnmanagedType.LPStr)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpLocalName;
        [MarshalAs(UnmanagedType.LPStr)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpRemoteName;
        [MarshalAs(UnmanagedType.LPStr)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpComment;
        [MarshalAs(UnmanagedType.LPStr)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; lpProvider;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ToString()
        {
            &lt;span class="kwrd"&gt;string&lt;/span&gt; str = &lt;span class="str"&gt;"LocalName: "&lt;/span&gt; + lpLocalName + &lt;span class="str"&gt;" RemoteName: "&lt;/span&gt; + lpRemoteName
            + &lt;span class="str"&gt;" Comment: "&lt;/span&gt; + lpComment + &lt;span class="str"&gt;" lpProvider: "&lt;/span&gt; + lpProvider;
            &lt;span class="kwrd"&gt;return&lt;/span&gt; (str);
        }
    } 


    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MapDriveTask : Microsoft.Build.Utilities.Task
    {
        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _Path              = String.Empty;
        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _DriveLetter       = String.Empty;
        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; _RemoveIfExists      = &lt;span class="kwrd"&gt;false&lt;/span&gt;;

        [DllImport(&lt;span class="str"&gt;"mpr.dll"&lt;/span&gt;)] 
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WNetAddConnection2A
            ( 
                [MarshalAs(UnmanagedType.LPArray)] NETRESOURCEA[] lpNetResource, 
                [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; lpPassword, 
                [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; UserName, &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags
             );

        [DllImport(&lt;span class="str"&gt;"mpr.dll"&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WNetCancelConnection2A
            (
                [MarshalAs(UnmanagedType.LPStr)] &lt;span class="kwrd"&gt;string&lt;/span&gt; lpName,
                &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags,
                &lt;span class="kwrd"&gt;bool&lt;/span&gt; fForce
            );

        [DllImport(&lt;span class="str"&gt;"Kernel32.dll"&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; FormatMessage
            (
            &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags,
            IntPtr lpSource,
            &lt;span class="kwrd"&gt;int&lt;/span&gt; dwMessageID,
            &lt;span class="kwrd"&gt;int&lt;/span&gt; dwLanguageID,
            StringBuilder lpBuffer,
            &lt;span class="kwrd"&gt;int&lt;/span&gt; nSize,
            IntPtr arguments
            ); 


        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; RemoveIfExists
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _RemoveIfExists;
            }
            set
            {
                _RemoveIfExists = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }


        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Path
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _Path;
            }
            set
            {
                _Path = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }

        [Required]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DriveLetter
        {
            get
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _DriveLetter;
            }
            set
            {
                _DriveLetter = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
            }
        }

        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; MapDrive()
        { 
            NETRESOURCEA[] resources    = &lt;span class="kwrd"&gt;new&lt;/span&gt; NETRESOURCEA[1];
            resources[0]                = &lt;span class="kwrd"&gt;new&lt;/span&gt; NETRESOURCEA();
            resources[0].dwType = 1;
            &lt;span class="kwrd"&gt;int&lt;/span&gt; dwFlags = 1;
            resources[0].lpLocalName = _DriveLetter;
            resources[0].lpRemoteName = _Path;
            resources[0].lpProvider = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = WNetAddConnection2A(resources, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;, dwFlags);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;
        }

        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; UnmapDrive()
        {
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = WNetCancelConnection2A(_DriveLetter, 0, &lt;span class="kwrd"&gt;true&lt;/span&gt;);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;
        }

        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Execute()
        {
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = MapDrive();
            &lt;span class="kwrd"&gt;int&lt;/span&gt; ret3 = 0;
            &lt;span class="kwrd"&gt;bool&lt;/span&gt; success = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
            StringBuilder message = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
            &lt;span class="kwrd"&gt;int&lt;/span&gt; messageId = FormatMessage(4096, IntPtr.Zero, ret, 0, message, 500, IntPtr.Zero);
            Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret });
            Log.LogMessage(&lt;span class="str"&gt;"Mapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { message.ToString() });

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (ret == 85 &amp;amp;&amp;amp; RemoveIfExists)
            {
                &lt;span class="kwrd"&gt;int&lt;/span&gt; ret2 = UnmapDrive();
                StringBuilder unmapMessage = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
                FormatMessage(4096, IntPtr.Zero, ret2, 0, unmapMessage, 500, IntPtr.Zero);
                Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret2 });
                Log.LogMessage(&lt;span class="str"&gt;"Unmapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { unmapMessage.ToString() });

                ret3 = MapDrive();
                StringBuilder mapMessage = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder(500);
                &lt;span class="kwrd"&gt;int&lt;/span&gt; mapMessageId = FormatMessage(4096, IntPtr.Zero, ret3, 0, mapMessage, 500, IntPtr.Zero);
                Log.LogMessage(&lt;span class="str"&gt;"Format Message Result:  {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { ret3 });
                Log.LogMessage(&lt;span class="str"&gt;"Second Mapping Result: {0}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { mapMessage.ToString() });
                success = !(ret3 &amp;gt; 85);
            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt;
            {
                success = !(ret &amp;gt; 0);
            }

            &lt;span class="kwrd"&gt;return&lt;/span&gt; success;
           
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you compile this code, you can then use this task in your MsBuild Xml file like so:&lt;/p&gt;
&lt;p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Project&lt;/span&gt; &lt;span class="attr"&gt;DefaultTargets&lt;/span&gt;&lt;span class="kwrd"&gt;="MyTarget"&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/developer/msbuild/2003"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;UsingTask&lt;/span&gt; &lt;span class="attr"&gt;AssemblyFile&lt;/span&gt;&lt;span class="kwrd"&gt;="ExcellenceInSoftware.MsBuild.Tasks.dll"&lt;/span&gt; &lt;span class="attr"&gt;TaskName&lt;/span&gt;&lt;span class="kwrd"&gt;="ExcellenceInSoftware.MsBuild.Tasks.MapDriveTask"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Target&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;="MyTarget"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;MapDriveTask&lt;/span&gt; &lt;span class="attr"&gt;Path&lt;/span&gt;&lt;span class="kwrd"&gt;="\\coke\Projects"&lt;/span&gt; &lt;span class="attr"&gt;DriveLetter&lt;/span&gt;&lt;span class="kwrd"&gt;="Z:"&lt;/span&gt; &lt;span class="attr"&gt;RemoveIfExists&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Target&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Project&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;p&gt;There you have it.&amp;nbsp; MsBuild is going to make life a whole alot easier when it comes to building, compiling, and deploying.&lt;/p&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=47" width="1" height="1"&gt;</description></item><item><title>Anonymous Predicates :: Anonymous Actions - Pred's a Whaticate extra.</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/15/44.aspx</link><pubDate>Tue, 15 Aug 2006 08:08:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:44</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/44.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=44</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/44.aspx</wfw:comment><description>&lt;P&gt;A commentator on my last series of posts requested some information on how to use anonymous methods within predicates.&amp;nbsp; So, here goes:&lt;/P&gt;
&lt;P&gt;For the sake of review, let's take a quick look at what an &lt;EM&gt;anonymous method&lt;/EM&gt; is in .NET 2.0 (a strict 2.0 feature).&lt;/P&gt;
&lt;P&gt;Basically, an anonymous method is a method that has no name and therefore it is anonymous.&amp;nbsp; That should wrap this post up.&amp;nbsp; Tune in tomorrow.&lt;/P&gt;
&lt;P&gt;Just kidding.&lt;/P&gt;
&lt;P&gt;First off, you need to have a good understanding of delegates to know what an anonymous method can do for you.&amp;nbsp; In short, a delegate is a pointer to a method that is typically used within events or executing code across different threads.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;However, the downside to a delegate is that sometimes I found myself creating a method just for the purpose of being referenced by a delegate.&amp;nbsp; That got annoying because the method served no purpose outside of its respective delegate.&amp;nbsp; So, let's check out how we can use an anonymous method within the declaration of a predicate:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Predicate&amp;lt;Employee&amp;gt; accounting = &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;(Employee e)
{
   &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (e.Department == &lt;SPAN class=str&gt;"Accounting"&lt;/SPAN&gt;);
};&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;This almost looks the same as what we had previously declared in part 1 of my previous post except you can see that rather than have the accounting Predicate point to the 'IsInAccountingDepartment' method, we actually have the method code inside that accounting Predicate itself using the brackets.&amp;nbsp; Thus, the code used in the IsInAccountDepartment method is now actually part of the Predicate signature.&lt;/P&gt;
&lt;P&gt;This exact same design can be used within Actions as well.&amp;nbsp; &lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=44" width="1" height="1"&gt;</description></item><item><title>TickSpot - By the Mole Hill</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/14/43.aspx</link><pubDate>Mon, 14 Aug 2006 18:45:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:43</guid><dc:creator>Shaun</dc:creator><slash:comments>2</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/43.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=43</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/43.aspx</wfw:comment><description>&lt;P&gt;I am never ceased to be amazed by my friend Tom Rossi who runs a company called &lt;A href="http://www.themolehill.com"&gt;The Mole Hill&lt;/A&gt; out of Jacksonville, Florida.&lt;/P&gt;
&lt;P&gt;Honestly, when he told me that he was switching to the Ruby on Rails development platform I knew he had lost it.&lt;/P&gt;
&lt;P&gt;He proved me wrong 100 times over.&lt;/P&gt;
&lt;P&gt;Their first application called '&lt;A href="http://www.tickspot.com"&gt;TickSpot&lt;/A&gt;' has taken off.&amp;nbsp; &lt;A href="http://www.tickspot.com"&gt;Tick &lt;/A&gt;is a simple time tracking application that helps you hit your budgets.&amp;nbsp; It has received recognition from &lt;A href="http://reviews.cnet.com/4531-10921_7-6553035.html?tag=blog"&gt;CNET &lt;/A&gt;and is already running over 2000 users in its current beta state.&amp;nbsp; It is a thoroughly impressive application that makes use of some extremely agile technologies.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Not only is &lt;A href="http://www.tickspot.com"&gt;Tick &lt;/A&gt;an application but I think it will soon become a leader of a new development philosophy.&amp;nbsp; Check out some of these posts at their blog:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.themolehill.com/index.php/2006/08/10/how-should-we-think-about-our-time-in-the-service-industry/"&gt;How Should We Think About Time in the Service Industry&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.themolehill.com/index.php/2006/07/29/beginners-guide-model-view-controller-mvc-architecture/"&gt;Beginner's Guide:&amp;nbsp; Model - View - Controller Architecture&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.themolehill.com/index.php/2006/07/24/beginners-guide-setting-up-ruby-on-rails-in-windows/"&gt;Beginner's Guide:&amp;nbsp; Setting Up Ruby on Windows&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I, for one, believe The Mole Hill is going to create a new software paradigm for us developers because of the innovative ideas of its owners.&amp;nbsp; Sooner or later it is very possible for Enterprise Applications to be developed within Ruby (especially as computers become faster and can handle larger footprints).&lt;/P&gt;
&lt;P&gt;As .NET Developers it is critical we move outside of our application domains as to not hinder our own innovation.&amp;nbsp; People want new ideas and desire to participate in products such as Tick because ... well ... it's just fun.&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=43" width="1" height="1"&gt;</description></item><item><title>Another Sweet Tool</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/14/42.aspx</link><pubDate>Mon, 14 Aug 2006 18:27:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:42</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/42.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=42</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/42.aspx</wfw:comment><description>&lt;P&gt;An incredible tool for your VPC's (Hat Tip:&amp;nbsp; &lt;A href="http://www.andrewconnell.com"&gt;Andrew Connell&lt;/A&gt;):&lt;/P&gt;
&lt;P&gt;&lt;A href="http://andrewconnell.com/blog/archive/2006/08/14/3361.aspx"&gt;http://andrewconnell.com/blog/archive/2006/08/14/3361.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=42" width="1" height="1"&gt;</description></item><item><title>SQL Express Backups</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/13/39.aspx</link><pubDate>Mon, 14 Aug 2006 04:22:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:39</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/39.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=39</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/39.aspx</wfw:comment><description>&lt;P&gt;I have been looking for something like this for a long time:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.whiteknighttechnology.com/cs/blogs/brian_knight/archive/2006/08/13/215.aspx"&gt;http://www.whiteknighttechnology.com/cs/blogs/brian_knight/archive/2006/08/13/215.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;White Knight Technology finally created one that is actually quite useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=39" width="1" height="1"&gt;</description></item><item><title>Pred is a whaticate? Generics on Steroids - Part II of II</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/13/33.aspx</link><pubDate>Sun, 13 Aug 2006 18:32:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:33</guid><dc:creator>Shaun</dc:creator><slash:comments>0</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/33.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=33</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/33.aspx</wfw:comment><description>&lt;P&gt;If your application has a requirement that a certain number of user's need to be selected and then all of them promoted/demoted to a certain position within the company you would probably, again, have to iterate through your pre-filtered EmployeeCollection and change each user's department while performing the iteration.&amp;nbsp; Although this is not difficult, it isn't something that is highly reusable and the code just looks plain nasty.&amp;nbsp; This is where .NET 2.0 Actions come into play nicely and also allow for some reusability of business processes throughout your code.&amp;nbsp; First, let's create a method that our Action will point to:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; PromoteEmployeeToExecutive(Employee e)
{
    Console.WriteLine(&lt;SPAN class=str&gt;"Promoting Employee {0} to CEO."&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt;[] { e.Id });
    e.Department = &lt;SPAN class=str&gt;"CEO"&lt;/SPAN&gt;;
}&lt;/PRE&gt;
&lt;P&gt;This is fairly simple method.&amp;nbsp; It takes the Employee object that is receives and changes the department property to CEO.&amp;nbsp; Nothing to it.&amp;nbsp; Now, take a look at the .NET 2.0 Action we need to create to that points to this method:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Action&amp;lt;Employee&amp;gt; promoteToExecutive = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Action&amp;lt;Employee&amp;gt;(PromoteEmployeeToExecutive);&lt;/PRE&gt;
&lt;P&gt;Here we are instantiating an Action of type Employee called promoteToExecutive.&amp;nbsp; This action is then pointed to the method we created above called PromoteEmployeeToExecutive.&amp;nbsp; Thus, anytime our code uses the promoteToExecutive Action, the PromoteEmployeeToExecutive is called.&amp;nbsp; Take a look at the implementation:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt; [Test]
 &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; PromoteAllToExecutives()
 {
      EmployeeCollection employees = FromXml();
      employees.ForEach(promoteToExecutive);
 }&lt;/PRE&gt;
&lt;P&gt;The FromXml() method is just a method that is importing the xml file from the previous article into my custom EmployeeCollection object.&amp;nbsp; When the data has been imported, we then call the ForEach method on the EmployeeCollection and pass it the promoteToExecutive Action instance.&amp;nbsp; By doing this, every single Employee within the EmployeeCollection will have their respective Department properties set to CEO.&amp;nbsp; Simple as that.&amp;nbsp; &lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=33" width="1" height="1"&gt;</description></item><item><title>Pred is a whaticate? Generics on Steroids - Part I of II</title><link>http://community.eisoft.com/blogs/.net/archive/2006/08/12/32.aspx</link><pubDate>Sat, 12 Aug 2006 18:14:00 GMT</pubDate><guid isPermaLink="false">f642ea88-9293-4c2a-90f8-6ed8c81d980c:32</guid><dc:creator>Shaun</dc:creator><slash:comments>2</slash:comments><comments>http://community.eisoft.com/blogs/.net/comments/32.aspx</comments><wfw:commentRss>http://community.eisoft.com/blogs/.net/commentrss.aspx?PostID=32</wfw:commentRss><wfw:comment>http://community.eisoft.com/blogs/rsscomments/32.aspx</wfw:comment><description>&lt;P&gt;I mean:&amp;nbsp; What is a predicate?&lt;/P&gt;
&lt;P&gt;To be honest, at the beginning I got tired of all of the hype of &lt;EM&gt;.NET Generics&lt;/EM&gt;.&amp;nbsp; Yes, they are pretty neat but I could never see their use outside of creating strongly typed collections with a few lines of code.&lt;/P&gt;
&lt;P&gt;Was I wrong.&lt;/P&gt;
&lt;P&gt;So, I set out to prove to people some of the sweet things that .NET Generics can do for us programmers; to be honest, the possibilities are limitless when one takes reflection and anonymous methods into the picture.&lt;/P&gt;
&lt;P&gt;Let's see what .NET Generics can do in the real life of a programmer by starting with this class:&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Collections.Generic;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Text;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Xml.Serialization;

&lt;SPAN class=kwrd&gt;namespace&lt;/SPAN&gt; ExcellenceInSoftware.Examples.Generics.EmployeeServices
{
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Employee
    {
        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; _Id;
        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _FirstName      = String.Empty;
        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _MiddleInitial  = String.Empty;
        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _LastName       = String.Empty;
        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; _Department     = String.Empty;

        [XmlAttribute]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; Id
        {
            get
            {
                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _Id;
            }
            set
            {
                _Id = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;;
            }
        }

        [XmlAttribute]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; FirstName
        {
            get
            {
                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _FirstName;
            }
            set
            {
                _FirstName = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;;
            }
        }

        [XmlAttribute]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; MiddleInitial
        {
            get
            {
                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _MiddleInitial;
            }
            set
            {
                _MiddleInitial = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;;
            }
        }

        [XmlAttribute]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; LastName
        {
            get
            {
                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _LastName;
            }
            set
            {
                _LastName = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;;
            }
        }

        [XmlAttribute]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; Department
        {
            get
            {
                &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; _Department;
            }
            set
            {
                _Department = &lt;SPAN class=kwrd&gt;value&lt;/SPAN&gt;;
            }
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;So, that is just a simple class that contains information about a virtual Employee.&amp;nbsp; I have prepared the class for Xml Serialization because I plan to populate the data from an xml file.&amp;nbsp; So, the [XmlAttribute] class is really a side note here.&lt;/P&gt;
&lt;P&gt;Now, back in the day before .NET 2.0 if one wanted to have a custom collection of Employees that might create a class called EmployeeCollection that inherited from a System.Collections.ArrayList.&amp;nbsp; The downside to this method was that the collection was not strongly typed and therefore, the possibilities for more runtime errors exist.&amp;nbsp; However, in .NET 2.0 generics solved this problem.&amp;nbsp; Here is my EmployeeCollection class that inherits from a Generic List:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Collections.Generic;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Text;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Xml;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Xml.Serialization;

&lt;SPAN class=kwrd&gt;namespace&lt;/SPAN&gt; ExcellenceInSoftware.Examples.Generics.EmployeeServices
{
    [Serializable]
    [XmlRoot(&lt;SPAN class=str&gt;"Employees"&lt;/SPAN&gt;)]
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; EmployeeCollection : System.Collections.Generic.List&amp;lt;Employee&amp;gt;
    {
    }
}
&lt;/PRE&gt;
&lt;P&gt;Now, again, ignore the Xml Serialization attributes because they have nothing to do with these examples.&amp;nbsp; What we have here is a simple class that inherits from System.Collections.Generic.List using the type (&amp;lt;T&amp;gt;) of Employee.&amp;nbsp; Thus, all methods contained within the EmployeeCollection class and its base classes will automatically require me to pass an Employee object to them in order to be successfully compiled.&amp;nbsp; But that is not the point of this highly instructionable post.&amp;nbsp; Take a look at the data I am going to populate my EmployeeCollection with:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="utf-8"&lt;/SPAN&gt;?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employees&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2002"&lt;/SPAN&gt;  &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Jonathan"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="C"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Stewart"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Accounting"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2003"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Michael"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="X"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Thadson"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Accounting"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2004"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Habib"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="M"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Sedieri"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Accounting"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2005"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Michelle"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="B"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Lawson"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Human Resources"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2006"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Tyra"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="K"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Whitaker"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Human Resources"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2007"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Bethany"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="F"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Moore"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Risk Management"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2008"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Jonathan"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="C"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Stewart"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Risk Management"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employee&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2009"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Ponce"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;MiddleInitial&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="C"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;LastName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="DeLeon"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Department&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Legal"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Employees&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;
&lt;P&gt;Simple data used for an example.&amp;nbsp; Let's take a look at some of the 'real-life' tasks that we might be required to perform in a production environment.&amp;nbsp; One of our virtual requirements is to find all Employees that are in the Accounting department after the EmployeeCollection has been populated with this data above.&amp;nbsp; In .NET 1.1 we could have easily created another EmployeeCollection and added Employee objects to it while looping through a for-each statement, but that was always a tad tedious and actually consumed more memory than I'd&amp;nbsp; like it to.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Enter .NET 2.0 Predicates and Actions.&lt;/P&gt;
&lt;P&gt;If you take a look at the documentation for a System.Collections.Generic.List it has 2 methods that I want to demonstrate here - FindAll and ForEach.&lt;/P&gt;
&lt;P&gt;The FindAll method takes a .NET 2.0 Predicate as a parameter and the ForEach method takes a .NET 2.0 Action as a parameter.&lt;/P&gt;
&lt;P&gt;A .NET 2.0 Predicate is pretty much the same thing as a delegate but it's signature is a little bit different.&amp;nbsp; A Predicate is basically a pointer to a method that will perform a task on each item within the collection.&amp;nbsp; So, let's declare our Predicate:&lt;/P&gt;
&lt;P&gt;First, we need the method that the Predicate will point to -&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt; IsInAccountingDepartment(Employee e)
{
     &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (e.Department == &lt;SPAN class=str&gt;"Accounting"&lt;/SPAN&gt;);
}&lt;/PRE&gt;
&lt;P&gt;
&lt;P&gt;All this method does is check to see if the respective Employee is in the Accounting department and returns 'true' if so.&amp;nbsp; Now, we need to declare the instance of the predicate that points to the above method:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Predicate&amp;lt;Employee&amp;gt; accounting = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Predicate&amp;lt;Employee&amp;gt;(IsInAccountingDepartment);&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Here, we create a new Predicate of type Employee called accounting.&amp;nbsp; Then, within the constructor of the Predicate, we point it to the method created above called 'IsInAccountingDepartment'.&amp;nbsp; Therefore, any method that references the 'accounting' predicate will automatically be pointed to the 'IsInAccountDepartment' method.&amp;nbsp; Let's take a look at the implementation:&lt;/P&gt;
&lt;P&gt;&lt;PRE class=csharpcode&gt;        [Test]
        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; FindTotalAccountingEmployees()
        {
            EmployeeCollection employees = FromXml();
            List&amp;lt;Employee&amp;gt; accountingEmployees = employees.FindAll(accounting);
            Console.WriteLine(&lt;SPAN class=str&gt;"Total Accounting Employees:  "&lt;/SPAN&gt; + accountingEmployees.Count.ToString());
        }&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;In this method FindTotalAccountingEmployees I first populate my EmployeeCollection using a method called FromXml() that basically reads the xml file above into the collection of Employee objects.&amp;nbsp; Then, I create an instance of the 'List' generic called accountingEmployees that is populate from the FindAll method of the EmployeeCollection.&amp;nbsp; Notice how I passed in our Predicate instance called 'accounting' into the FindAll method.&lt;/P&gt;
&lt;P&gt;Amazing as it is, it returns 3 employees which is the correct number of Employees in the accounting department per the Xml file shown previously in this document.&lt;/P&gt;
&lt;P&gt;So, what is happening here?&amp;nbsp; Basically, when the FindAll method is called on the EmployeeCollection object using the accounting Predicate, each Employee contained with the EmployeeCollection is sent to the 'IsInAccountingDepartment' method and if that method returns true, the respective Employee object is added to the accountingEmployees list.&amp;nbsp; Therefore, the accountingEmployees list only contains Employees who are in the Accounting department.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;A real-life scenario that doesn't use foobars.&amp;nbsp; Makes sense to me.&lt;/P&gt;
&lt;P&gt;Tomorrow, I will demonstrate what a .NET 2.0 Action is and how to promote all Employees within an EmployeeCollection to the same department.&amp;nbsp; Until then...&lt;/P&gt;
&lt;P&gt;stop programming and start developing the business.&lt;/P&gt;&lt;img src="http://community.eisoft.com/aggbug.aspx?PostID=32" width="1" height="1"&gt;</description></item></channel></rss>