<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rhonda Tipton&#039;s Blog &#187; C#</title>
	<atom:link href="http://rhondatipton.net/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://rhondatipton.net</link>
	<description>Stuff I Learn, Stuff I Like</description>
	<lastBuildDate>Fri, 13 Jan 2012 04:59:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rhondatipton.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rhonda Tipton&#039;s Blog &#187; C#</title>
		<link>http://rhondatipton.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rhondatipton.net/osd.xml" title="Rhonda Tipton&#039;s Blog" />
	<atom:link rel='hub' href='http://rhondatipton.net/?pushpress=hub'/>
		<item>
		<title>Reading The Windows Event Log</title>
		<link>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/</link>
		<comments>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/#comments</comments>
		<pubDate>Sun, 19 Dec 2010 14:06:03 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">https://rtipton.wordpress.com/2010/12/19/reading-the-windows-event-log/</guid>
		<description><![CDATA[I had a need recently to access the Windows event logs. Reading the Event Log is useful when you want to be notified when a program fails. You read the Events and if there is a fatal error, do something like send an email the owner of the process. This is helpful if you have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1868&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img style="display:inline;border-width:0;" title="IMG_3365" src="http://rtipton.files.wordpress.com/2010/12/img_3365.jpg?w=400&#038;h=170" border="0" alt="IMG_3365" width="400" height="170" /></p>
<p>I had a need recently to access the Windows event logs. Reading the Event Log is useful when you want to be notified when a program fails. You read the Events and if there is a fatal error, do something like send an email the owner of the process. This is helpful if you have a console application that runs all the time unattended.</p>
<p>The .Net Framework offers the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx" target="_blank">System.Diagnostics.EventLog</a> class. This class gives you the power to interact with the Windows event logs.</p>
<p>&nbsp;</p>
<p>Below is a C# program that accesses the Windows event logs.</p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Text;
<span style="color:blue;">using </span>System.Diagnostics;

<span style="color:blue;">class </span><span style="color:#2b91af;">Program
</span>{
    <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
    {
        <span style="color:#2b91af;">StringBuilder </span>sb = <span style="color:blue;">new </span><span style="color:#2b91af;">StringBuilder</span>();
        <span style="color:#2b91af;">EventLog </span>log = <span style="color:blue;">new
        </span><span style="color:#2b91af;">EventLog</span>(<span style="color:#a31515;">"Application"</span>);

        <span style="color:#2b91af;">DateTime </span>dt = <span style="color:#2b91af;">DateTime</span>.Now.AddHours(-1.00);
        <span style="color:#2b91af;">Console</span>.WriteLine(dt.ToString());

        <span style="color:blue;">foreach </span>(<span style="color:#2b91af;">EventLogEntry </span>entry <span style="color:blue;">in </span>log.Entries)
        {
            <span style="color:blue;">if </span>(entry.TimeGenerated &gt; dt)
            {
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.Source);
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.EntryType);
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.Message);
                <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"--------"</span>);
            }
        }

        <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Done"</span>);
        <span style="color:#2b91af;">Console</span>.ReadLine();
    }
}</pre>
<div><span style="font-size:xx-small;"><a href="https://gist.github.com/341885" target="_blank">C# Listing on GitHub</a></span></div>
<p>&nbsp;</p>
<p>Below is the result of executing the code above. As you can see I had a crash in my Windows Live Writer Application.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/12/20101219_073757.jpg" target="_blank"><img style="display:inline;border-width:0;" title="2010-12-19_073757" src="http://rtipton.files.wordpress.com/2010/12/20101219_073757_thumb.jpg?w=499&#038;h=252" border="0" alt="2010-12-19_073757" width="499" height="252" /></a></p>
<p>&nbsp;</p>
<p>Below is the Event Viewer and you can see there as well where there was an issue with the WLW application.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/12/20101219_074318.jpg" target="_blank"><img style="display:inline;border-width:0;" title="2010-12-19_074318" src="http://rtipton.files.wordpress.com/2010/12/20101219_074318_thumb.jpg?w=503&#038;h=378" border="0" alt="2010-12-19_074318" width="503" height="378" /></a></p>
<p>&nbsp;</p>
<p>I can see where this class can be very helpful and plan on doing more research into what it can do as far as reading as well as writing operations.</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;">Related Information</span></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx" target="_blank">EventLog Class Definition and Specifications on MSDN</a></li>
<li><a href="http://www.codeproject.com/KB/dotnet/SystemDiagnostics_basics.aspx" target="_blank">Beginning System.Diagnostics on CodeProject</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1868/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1868&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/img_3365.jpg" medium="image">
			<media:title type="html">IMG_3365</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/20101219_073757_thumb.jpg" medium="image">
			<media:title type="html">2010-12-19_073757</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/20101219_074318_thumb.jpg" medium="image">
			<media:title type="html">2010-12-19_074318</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Special Interest Group &#8211; 11/30/2010</title>
		<link>http://rhondatipton.net/2010/12/06/c-special-interest-group-11302010/</link>
		<comments>http://rhondatipton.net/2010/12/06/c-special-interest-group-11302010/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 02:08:27 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">https://rtipton.wordpress.com/2010/12/06/c-special-interest-group-11302010/</guid>
		<description><![CDATA[I attended the Houston C# SIG last Tuesday. Alan Stevens did a great presentation titled The Taming of the Code. In this presentation he talked about the importance of constant learning and refactoring. Below are some of the high points I picked up. 1. The Goal Build the right thing and build it well Technical [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1861&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I attended the Houston C# SIG last Tuesday. <a href="http://twitter.com/alanstevens" target="_blank">Alan Stevens</a> did a great presentation titled The Taming of the Code.
<p><img style="border-width:0;" border="0" alt="AlanStevens" src="http://rtipton.files.wordpress.com/2010/12/alanstevens.jpg?w=260&#038;h=224" width="260" height="224">
<p>In this presentation he talked about the importance of constant learning and refactoring.
<p>Below are some of the high points I picked up.
<p><u>1. The Goal</u>
<ul>
<li>Build the right thing and build it well
<li><a href="http://en.wikipedia.org/wiki/Technical_debt" target="_blank">Technical Debt</a> &#8211; Shipping the right thing even though it is not perfect
<li>Do the simplest thing that can possibly work
<li>Enable change</li>
</ul>
<p>Build architectural seams or fault lines into your code, so if need be, it can be picked up and &#8220;stitched in&#8221; somewhere else
<p>*ilities
<ul>
<li>Agility
<li>Testability
<li>Readability
<li>Reversability
<li>Changeability
<li>Flexibility
<li>Maintainability</li>
</ul>
<p><a href="http://en.wikipedia.org/wiki/Domain-driven_design" target="_blank">Domain Driven Design</a>
<p><u>2. The Guidelines</u>
<p><a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" target="_blank">Don&#8217;t Repeat Yourself</a> (DRY) and <a href="http://en.wikipedia.org/wiki/Separation_of_concerns" target="_blank">Separation of Concerns</a> are the yin and yang of Software Development
<p>Examples of Separation of Concerns are MVC, MVP, HTML, CSS, JavaScript, (UI+Service+DAL).
<p><em><a href="http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29" target="_blank">SOLID Principals</a></em>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Single_responsibility_principle" target="_blank">Single Responsibility Principle</a>
<li><a href="http://en.wikipedia.org/wiki/Open/closed_principle" target="_blank">Open Closed Principle</a>
<li><a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" target="_blank">Liskov Substitution Principle</a>
<li><a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" target="_blank">Interface Segregation Principle</a>
<li><a href="http://en.wikipedia.org/wiki/Dependency_inversion_principle" target="_blank">Dependancy Inversion Principle</a></li>
</ul>
<p><u>3. The Practice</u>
<p>A feedback loop is needed (code reviews, pair programming)
<p><a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank">Test Driven Development</a>
<p><a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx" target="_blank">Yield keyword</a>
<p>&#8211;
<p><u>Additional Information</u>
<ul>
<li><a href="http://qcon.infoq.com/" target="_blank">QConn Conferences</a>
<li><a href="http://www.virtualbrownbag.com/" target="_blank">Virtual Brown Bag</a> &#8211; Weekly meetings held on Thursdays.
<li><a href="http://www.timesnapper.com/" target="_blank">Time Snapper</a> &#8211; Automatic screen shot journal
<li><a href="http://xunit.codeplex.com/" target="_blank">XUNIT.NET</a> &#8211; Testing framework</li>
</ul>
<ul>&#8211;</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1861/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1861&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/12/06/c-special-interest-group-11302010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/alanstevens.jpg" medium="image">
			<media:title type="html">AlanStevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging: Failed to Enable Constraints</title>
		<link>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/</link>
		<comments>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 02:38:34 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">https://rtipton.wordpress.com/2010/11/23/debugging-failed-to-enable-constraints/</guid>
		<description><![CDATA[I have a DataSet that has had a new field added to it recently. When my console application runs, it was throwing a &#8220;Failed to enable constraints&#8221; exception. I needed to find out which column in the DataSet was causing the error, so a co-worker suggested I create a temporary data adapter/set, so I can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1849&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have a DataSet that has had a new field added to it recently. When my console application runs, it was throwing a &#8220;Failed to enable constraints&#8221; exception.</p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2010/11/image.png?w=500&#038;h=59" width="500" height="59"> </p>
<p>I needed to find out which column in the DataSet was causing the error, so a co-worker suggested I create a temporary data adapter/set, so I can examine the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.geterrors.aspx">GetErrors()</a> method.
<div>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#008000;">/*</span>
<span style="color:#008000;">*/</span>
<span style="color:#008000;">//-- Table Adaptor and DataSet with issue</span>

spRoxStaffImportTableAdapter roxStaffImportTA =
    <span style="color:#0000ff;">new</span> spRoxStaffImportTableAdapter();

RoxStaffImport.Data.StaffImport.spRoxStaffImportDataTable importdt =
    roxStaffImportTA.spRoxStaffImport();

<span style="color:#008000;">//-- Table Adaptor and DataSet with my temporary TA and DS</span>

spRoxStaffImportTableAdapter roxStaffImportTA =
    <span style="color:#0000ff;">new</span> spRoxStaffImportTableAdapter();

<span style="color:#008000;">//added for debugging</span>
RoxStaffImport.Data.StaffImport myDS =
    <span style="color:#0000ff;">new</span> RoxStaffImport.Data.StaffImport(); 

<span style="color:#008000;">//added for debugging</span>
roxStaffImportTA.spRoxStaffImportfl(myDS.spRoxStaffImport);

<span style="color:#008000;">//changed for debugging</span>
RoxStaffImport.Data.StaffImport.spRoxStaffImportDataTable importdt =
    myDS.spRoxStaffImport; //roxStaffImportTA.spRoxStaffImport();</pre>
</div>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><font size="1"><a href="https://gist.github.com/711051">C# Listing on GitHub</a></font> </p>
<p>Once the exception occurs, access the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.geterrors.aspx">GetErrors()</a> property using the Watch window. This will tell you exactly what your issue is.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/11/image1.png" target="_blank"><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2010/11/image_thumb.png?w=554&#038;h=181" width="554" height="181"></a> </p>
<p>Once the issue is fixed, you can remove the temporary data adapter/set.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1849/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1849&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/11/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Using GetProperties() in C#</title>
		<link>http://rhondatipton.net/2010/02/28/using-getproperties-in-c/</link>
		<comments>http://rhondatipton.net/2010/02/28/using-getproperties-in-c/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 00:18:10 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2010/02/28/using-getproperties-in-c/</guid>
		<description><![CDATA[Reflection, in the simple terms, is the ability to extract information about an object during runtime. I found a great explanation of why Reflection is used in a tutorial titled Reflection in C#. With reflection we can dynamically create an instance of a type, bind the type to an existing object, or get the type [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1470&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Reflection, in the simple terms, is the ability to extract information about an object during runtime. I found a great explanation of why Reflection is used in a tutorial titled <a href="http://www.codersource.net/microsoft-net/c-basics-tutorials/reflection-in-c.aspx" target="_blank">Reflection in C#</a>.</p>
<blockquote><p>With reflection we can dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If Attributes (C#) are used in application, then with help of reflection we can access these attributes. It can be even used to emit Intermediate Language code dynamically so that the generated code can be executed directly.</p>
</blockquote>
<p>I have been doing some research and test apps using the <a href="http://msdn.microsoft.com/en-us/library/aa332492%28VS.71%29.aspx" target="_blank">GetProperties</a> method. <a href="http://msdn.microsoft.com/en-us/library/aa332492%28VS.71%29.aspx" target="_blank">GetProperties</a> basically returns array of <a href="http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.aspx" target="_blank">PropertyInfo</a> objects.</p>
<p>&#8211;</p>
<p><strong>Sample Program</strong></p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Reflection;

<span style="color:blue;">class </span><span style="color:#2b91af;">Program
</span>{
    <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
    {
        <span style="color:blue;">var </span>person = <span style="color:blue;">new </span><span style="color:#2b91af;">Person
        </span>{
            Name = <span style="color:#a31515;">&quot;Rhonda&quot;</span>,
            FaveShow = <span style="color:#a31515;">&quot;Fringe, Lost&quot;</span>,
            FaveMovie = <span style="color:#a31515;">&quot;Star Trek&quot;</span>,
            FaveSong = <span style="color:#a31515;">&quot;Contagious&quot;
        </span>};

        <span style="color:blue;">var </span>type = <span style="color:blue;">typeof</span>(<span style="color:#2b91af;">Person</span>);
        <span style="color:blue;">var </span>properties = type.GetProperties();

        <span style="color:blue;">foreach </span>(<span style="color:#2b91af;">PropertyInfo </span>property <span style="color:blue;">in </span>properties)
        {
            <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;{0} : {1}&quot;</span>,
                             property.Name, property.GetValue(person, <span style="color:blue;">null</span>));
        }

        <span style="color:#2b91af;">Console</span>.Read();
    }
}

<span style="color:blue;">public class </span><span style="color:#2b91af;">Person
</span>{
    <span style="color:blue;">public string </span>Name { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
    <span style="color:blue;">public string </span>FaveShow { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
    <span style="color:blue;">public string </span>FaveMovie { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
    <span style="color:blue;">public string </span>FaveSong { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><font size="1"><a href="http://gist.github.com/338048" target="_blank">C# Listing on GitHub</a></font>&#160;</p>
<p>As you can see below there are several other methods available as well as <a href="http://msdn.microsoft.com/en-us/library/aa332492%28VS.71%29.aspx" target="_blank">GetProperties</a>.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/02/reflection1.jpg"><img style="border-width:0;" border="0" alt="Reflection1" src="http://rtipton.files.wordpress.com/2010/02/reflection1_thumb.jpg?w=389&#038;h=462" width="389" height="462" /></a></p>
<p>&#160;</p>
<p><strong>Output</strong></p>
<p><a href="http://rtipton.files.wordpress.com/2010/02/reflection2.jpg"><img style="border-width:0;" border="0" alt="Reflection2" src="http://rtipton.files.wordpress.com/2010/02/reflection2_thumb.jpg?w=361&#038;h=204" width="361" height="204" /></a></p>
<p>&#160;</p>
<p><strong>Additional Information</strong></p>
<ul>
<li><a href="http://www.csharp-examples.net/reflection-property-names/" target="_blank">Get Property Names using Reflection [C#]</a> </li>
<li><a href="http://www.switchonthecode.com/tutorials/csharp-tutorial-using-reflection-to-get-object-information" target="_blank">C# Tutorial &#8211; Using Reflection to Get Object Information</a> </li>
</ul>
<p>&#8211;</p>
<p>^..^</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1470/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1470&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/02/28/using-getproperties-in-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/reflection1_thumb.jpg" medium="image">
			<media:title type="html">Reflection1</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/reflection2_thumb.jpg" medium="image">
			<media:title type="html">Reflection2</media:title>
		</media:content>
	</item>
		<item>
		<title>HDNUG Meeting &#8211; 02/11/10 &#8211; Recap</title>
		<link>http://rhondatipton.net/2010/02/14/hdnug-meeting-021110-recap/</link>
		<comments>http://rhondatipton.net/2010/02/14/hdnug-meeting-021110-recap/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 21:55:30 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2010/02/14/hdnug-meeting-021110-recap/</guid>
		<description><![CDATA[I attended the February Houston .NET User Group meeting. There was a great turnout (80-90) considering how bad the weather was. The sponsor was New Horizons, an independent IT training company. &#160;&#160;&#160;&#160;&#160;&#160; AnnouncementsSome people from TechSmith will be here for next month&#8217;s meetingMeeting #100 is coming up quick. There will possibly be big prizes Main [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1440&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I attended the February <a href="http://www.hdnug.org" target="_blank">Houston .NET User Group</a> meeting. There was a great turnout (80-90) considering how bad the weather was. The sponsor was <a href="http://www.newhorizons.com" target="_blank">New Horizons</a>, an independent IT training company.
<p><a href="http://hdnug.org" target="_blank"><img style="border-width:0;" border="0" alt="hdnuglogo" src="http://rtipton.files.wordpress.com/2010/02/hdnuglogo.jpg?w=113&#038;h=84" width="113" height="84"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.newhorizons.com" target="_blank"><img style="border-width:0;" border="0" alt="newhorizons" src="http://rtipton.files.wordpress.com/2010/02/newhorizons.jpg?w=164&#038;h=74" width="164" height="74"></a>
<p><strong>Announcements</strong><br />Some people from <a href="http://www.techsmith.com/" target="_blank">TechSmith</a> will be here for next month&#8217;s meeting<br />Meeting #100 is coming up quick. There will possibly be big prizes </p>
<p><strong>Main Presentation<br /></strong><a href="http://www.markusegger.com/" target="_blank">Markus Egger</a> from <a href="http://www.eps-cs.com">EPS Software</a> did a great presentation on C# 4.0 focusing mainly on the Dynamic aspects.
<p><a href="http://www.eps-software.com/"><img style="border-width:0;" border="0" alt="eps" src="http://rtipton.files.wordpress.com/2010/02/eps.jpg?w=140&#038;h=76" width="140" height="76"></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.code-magazine.com/"><img style="border-width:0;" border="0" alt="codemag" src="http://rtipton.files.wordpress.com/2010/02/codemag.jpg?w=196&#038;h=65" width="196" height="65"></a>&nbsp;&nbsp;
<p>Types of .NET Lanuages
<ul>
<li>Traditional &#8211; C#, VB.NET
<li>Functional &#8211; F# &#8212; Book recommendation: <a href="http://books.google.com/books?id=NcrMkjVxahMC&amp;dq=expert+f%23&amp;printsec=frontcover&amp;source=bn&amp;hl=en&amp;ei=vmd4S4rMKc3-nAePn6TDCQ&amp;sa=X&amp;oi=book_result&amp;ct=result&amp;resnum=4&amp;ved=0CBYQ6AEwAw#v=onepage&amp;q=&amp;f=false" target="_blank">Expert F#</a>
<li>Dynamic &#8211; IronPython, IronRuby</li>
</ul>
<p>Dynamic (Python, Ruby, JavaScript) &#8211; Advantages
<ul>
<li>Simple
<li>Implicitly typed
<li>No compilation</li>
</ul>
<p>One of the main disadvantages of dynamic languages is the lack of Intellisense support.
<p>Static (C#, VB.NET) languages &#8211; Advantages
<ul>
<li>Performant
<li>Intelligent tools
<li>Better scaling</li>
</ul>
<p>DLR &#8211; Dynamic Language Runtime
<p><a href="http://rtipton.files.wordpress.com/2010/02/dlr.jpg" target="_blank"><img style="border-width:0;" border="0" alt="dlr" src="http://rtipton.files.wordpress.com/2010/02/dlr_thumb.jpg?w=404&#038;h=239" width="404" height="239"></a>
<p>DynamicObject class
<p>REST
<p>Named and Optional Parameters
<p>Improved COM Support
<p>&#8211;
<p><strong>Markus Egger&#8217;s Information</strong>
<ul>
<li><a href="http://www.markusegger.com/Blog/Development.aspx?messageid=2d7a8807-3aa6-495f-b3f2-2e34632e1c10" target="_blank">Presentation and Demos for C# 4.0 Dynamic Programming</a>
<li>Email &#8211; <a href="mailto:MEgger@eps-software.com">MEgger@eps-software.com</a>
<li>Twitter &#8211; <a href="http://twitter.com/MarkusEgger" target="_blank">@MarkusEgger</a>
<li>Blog &#8211; <a href="http://www.MarkusEgger.com/blog">http://www.MarkusEgger.com/blog</a></li>
</ul>
<p>&#8211;
<p><a href="http://rtipton.files.wordpress.com/2010/02/hdnugpic21.jpg" target="_blank"><img style="border-bottom:0;border-left:0;border-top:0;border-right:0;" border="0" alt="hdnugpic2" src="http://rtipton.files.wordpress.com/2010/02/hdnugpic2_thumb1.jpg?w=200&#038;h=260" width="200" height="260"></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://rtipton.files.wordpress.com/2010/02/hdnugpic11.jpg" target="_blank"><img style="border-bottom:0;border-left:0;border-top:0;border-right:0;" border="0" alt="hdnugpic1" src="http://rtipton.files.wordpress.com/2010/02/hdnugpic1_thumb1.jpg?w=200&#038;h=260" width="200" height="260"></a>
<p>&#8211;
<p>^..^  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1440/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1440&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/02/14/hdnug-meeting-021110-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/hdnuglogo.jpg" medium="image">
			<media:title type="html">hdnuglogo</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/newhorizons.jpg" medium="image">
			<media:title type="html">newhorizons</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/eps.jpg" medium="image">
			<media:title type="html">eps</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/codemag.jpg" medium="image">
			<media:title type="html">codemag</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/dlr_thumb.jpg" medium="image">
			<media:title type="html">dlr</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/hdnugpic2_thumb1.jpg" medium="image">
			<media:title type="html">hdnugpic2</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/hdnugpic1_thumb1.jpg" medium="image">
			<media:title type="html">hdnugpic1</media:title>
		</media:content>
	</item>
		<item>
		<title>Houston C# SIG Meeting &#8211; 01/19/10 &#8211; Recap</title>
		<link>http://rhondatipton.net/2010/02/02/houston-c-sig-meeting-011910-recap/</link>
		<comments>http://rhondatipton.net/2010/02/02/houston-c-sig-meeting-011910-recap/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 03:20:42 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2010/02/02/houston-c-sig-meeting-011910-recap/</guid>
		<description><![CDATA[A couple of weeks ago I attended the Houston C# SIG meeting. Ken Getz did presentations on both Silverlight and LINQ to Objects. Silverlight Ken defined Silverlight as a programmable browser plugin that supports animations, vector graphics and videos. Some features include &#8211; Works on Mac/Linux/Windows Client-side technologies Uses XAML for declarative design Expression Blend [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1415&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I attended the Houston C# SIG meeting. <a href="http://www.mcwtech.com/blogs/keng/" target="_blank">Ken Getz</a> did presentations on both <a href="http://silverlight.net" target="_blank">Silverlight</a> and LINQ to Objects. </p>
<p><strong>Silverlight</strong></p>
<p>Ken defined <a href="http://silverlight.net" target="_blank">Silverlight</a> as a programmable browser plugin that supports animations, vector graphics and videos. </p>
<p>Some features include &#8211; </p>
<ul>
<li>Works on Mac/Linux/Windows
<li>Client-side technologies
<li>Uses XAML for declarative design
<li><a href="http://www.microsoft.com/expression/" target="_blank">Expression Blend</a> &#8211; best software to use for <a href="http://silverlight.net" target="_blank">Silverlight</a>/<a href="http://msdn.microsoft.com/en-us/library/ms752059.aspx" target="_blank">XAML</a> design
<li>Visual Studio 2010 includes the components needed to build <a href="http://silverlight.net" target="_blank">Silverlight</a> apps out of the box </li>
</ul>
<p>The following site allows you to verify if your pc is able to run <a href="http://silverlight.net" target="_blank">Silverlight</a> applications <a href="http://www.microsoft.com/silverlight/get-started/install/default.aspx">http://www.microsoft.com/silverlight/get-started/install/default.aspx</a> </p>
<p><a href="http://silverlight.net" target="_blank">Silverlight</a> is basically an HTML page with an &lt;object&gt; tag. </p>
<p>&#8211; </p>
<p><strong>LINQ to Objects </strong></p>
<p>There are several <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank">LINQ</a> providers &#8211; </p>
<ul>
<li>Objects
<li>SQL
<li>DataSets
<li>XML
<li>Entities </li>
</ul>
<p><em>Example Usage</em></p>
<p><font size="2" face="Courier New">string[] geeks = { &#8220;Sheldon&#8221;, &#8220;Leonard&#8221;, &#8220;Howard&#8221;, &#8220;Raj&#8221;}; </font></p>
<p><font size="2" face="Courier New">var myQuery = from g in geeks<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orderby g<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select g; </font>
<p><font size="2" face="Courier New">Console.WriteLine(&#8220;My Favorite Geeks&#8221;); </font>
<p><font size="2" face="Courier New">foreach (var x in myQuery)<br />{<br />&nbsp;&nbsp;&nbsp; Console.WriteLine(x);<br />}</font>
<p><a href="http://rtipton.files.wordpress.com/2010/02/image.png"><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2010/02/image_thumb.png?w=366&#038;h=203" width="366" height="203"></a>
<p>Ken provided a very informative presentation on <a href="http://msdn.microsoft.com/en-us/library/bb397919.aspx" target="_blank">LINQ to Objects</a> and I am glad I was able to catch it.
<p><a href="http://cid-9b20ca2a70056a92.skydrive.live.com/self.aspx/.Public/LinqToObjects.zip" target="_blank">Ken&#8217;s LINQ demo code</a>
<p>&#8211;
<p>^..^</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1415/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1415&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/02/02/houston-c-sig-meeting-011910-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>More on Timers in .NET</title>
		<link>http://rhondatipton.net/2009/12/05/more-on-timers-in-net/</link>
		<comments>http://rhondatipton.net/2009/12/05/more-on-timers-in-net/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 01:49:19 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2009/12/05/more-on-timers-in-net/</guid>
		<description><![CDATA[In a previous post, I mentioned the three types of timers in the .NET Framework. In the comments of that post I had someone ask about the differences in why/when to use the different timers, so I thought I would do a little more research.&#160; I posted this inquiry to the ALT.NET Google Group and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1282&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://rtipton.wordpress.com/2009/11/06/timers-in-net/" target="_blank">previous post</a>, I mentioned the three types of timers in the .NET Framework. In the comments of that post I had someone ask about the differences in why/when to use the different timers, so I thought I would do a little more research.&nbsp;
<p>I posted this inquiry to the <a href="http://groups.google.com/group/houstonaltdotnet?hl=en" target="_blank">ALT.NET Google Group</a> and received the following responses:&nbsp;&nbsp;
<p><a href="http://flux88.com/blog" target="_blank">Ben Scheirman</a>&nbsp;</p>
<blockquote><p><em>Windows Forms timers are more to update things on the UI.</em>
<p><em>System.Threading.Timer is for performing timed actions in any .NET code.<br />For example, say you want to execute a function, but at a later time&#8230;<br />like &#8220;Call this method in 10 seconds&#8221;.&nbsp; You can also set it up to execute<br />some code at a regular interval.</em>
<p><em>The short answer, use WinForms timer when you&#8217;re working on a WinForm, and<br />use Threading.Timer everywhere else.</em></p>
</blockquote>
<p><a href="http://www.azamsharp.com" target="_blank">Mohammad Azam</a> suggested a great article that goes into great detail by <a href="http://msdn.microsoft.com/en-us/magazine/cc164015.aspx" target="_blank">Comparing the Timer Classes in the .NET Framework Class Library</a>.
<p>High point quotes from the article:<br />
<blockquote>
<p><em>[Talking about <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx" target="_blank">Windows.Forms.Timer</a>] Just like the rest of the code in a typical Windows Forms application, any code that resides inside a timer event handler (for this type of timer class) is executed using the application&#8217;s UI thread. During idle time, the UI thread is also responsible for processing all messages in the application&#8217;s Windows message queue.</em></p>
</blockquote>
<blockquote><p><em>The <a href="http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx" target="_blank">System.Timers.Timer</a> class will, by default, call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool. This means that the code inside your Elapsed event handler must conform to a golden rule of Win32 programming: an instance of a control should never be accessed from any thread other than the thread that was used to instantiate it.</em></p>
</blockquote>
<blockquote><p><em>[Talking about <a href="http://msdn.microsoft.com/en-us/library/system.threading.timer%28VS.71%29.aspx" target="_blank">System.Threading.Timer</a>] </em><em>Instances of this class are not inherently thread safe, given that it resides in the <a href="http://msdn.microsoft.com/en-us/library/system.threading%28VS.71%29.aspx" target="_blank">System.Threading namespace</a>. (Obviously, this doesn&#8217;t mean it can&#8217;t be used in a thread-safe manner.) The programmatic interface of this class is not consistent with the other two timer classes and it&#8217;s also a bit more cumbersome.</em></p>
</blockquote>
<p>From reading this article and the replies to my inquiry on the <a href="http://groups.google.com/group/houstonaltdotnet?hl=en" target="_blank">ALT.NET Google Group</a>, it sounds like if your needing a timer for the UI, use <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx" target="_blank">System.Windows.Forms.Timer</a>; otherwise, the <a href="http://msdn.microsoft.com/en-us/library/system.threading.timer%28VS.71%29.aspx" target="_blank">System.Threading.Timer</a> is the way to go.</p>
<p>&#8211;</p>
<p>^..^</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1282/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1282&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2009/12/05/more-on-timers-in-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>
	</item>
		<item>
		<title>Method Overloading</title>
		<link>http://rhondatipton.net/2009/11/27/method-overloading/</link>
		<comments>http://rhondatipton.net/2009/11/27/method-overloading/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 02:12:33 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2009/11/27/method-overloading/</guid>
		<description><![CDATA[Polymorphism is one of the main characteristics of Object Oriented Programming (OOP). Put simply, it allows an object to behave in various ways depending on the manner in which it is used. For example, you could have a method execute differently based on the type and/or number of parameters passed to it. Method Overloading is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1275&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming">Polymorphism</a> is one of the main characteristics of <a href="http://en.wikipedia.org/wiki/Object_Oriented_Programming">Object Oriented Programming (OOP)</a>. Put simply, it allows an object to behave in various ways depending on the manner in which it is used. For example, you could have a method execute differently based on the type and/or number of parameters passed to it. <a href="http://en.wikipedia.org/wiki/Method_overloading">Method Overloading</a> is what makes this example possible.&#160; To accomplish <a href="http://en.wikipedia.org/wiki/Method_overloading">Method Overloading</a>, a developer can define two or more methods with the same name. Each method will take a different set of parameters.&#160; The parameter combination or signature, is what the compiler uses to determine which method to use.</p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image5.png?w=300&#038;h=200" width="300" height="200" /></p>
<p>Good examples of <a href="http://en.wikipedia.org/wiki/Method_overloading">Method Overloading</a> in the .NET Framework include (but are not limited to) the <a href="http://msdn.microsoft.com/en-us/library/system.console.writeline.aspx">Console.WriteLine()</a> and <a href="http://msdn.microsoft.com/en-us/library/system.string.substring.aspx">Substring()</a> methods.&#160; You can pass different types to the <a href="http://msdn.microsoft.com/en-us/library/system.console.writeline.aspx">Console.WriteLine()</a> method and it will work because there are variations of the methods that will accept the different types.</p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image6.png?w=223&#038;h=72" width="223" height="72" /></p>
<p>&#8211;</p>
<p><u>C# Program</u></p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">namespace </span>MethodOverloading
{
  <span style="color:blue;">class </span><span style="color:#2b91af;">Program
  </span>{
     <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
     {
         MethodOverloadPlay(10, 3);
         <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;+++++&quot;</span>);
         MethodOverloadPlay(5, 5, 6);
         <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;+++++&quot;</span>);
         MethodOverloadPlay(<span style="color:#a31515;">&quot;SP&quot;</span>);
         <span style="color:#2b91af;">Console</span>.ReadLine();
     }

     <span style="color:blue;">static void </span>MethodOverloadPlay(<span style="color:blue;">int </span>number1, <span style="color:blue;">int </span>number2)
     {
         <span style="color:blue;">int </span>result = number1 + number2;
         <span style="color:#2b91af;">Console</span>.WriteLine(result);
     }

     <span style="color:blue;">static void </span>MethodOverloadPlay(<span style="color:blue;">int </span>number1, <span style="color:blue;">int </span>number2, <span style="color:blue;">int </span>number3)
     {
         <span style="color:blue;">int </span>result = number1 + number2 + number3;
         <span style="color:#2b91af;">Console</span>.WriteLine(result);
     }

     <span style="color:blue;">static void </span>MethodOverloadPlay(<span style="color:blue;">string </span>string1)
     {
         <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;Breaking Benjamin &amp; Sick Puppies Rock!&quot;</span>);
     }
  }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><font size="1"><a href="http://gist.github.com/338432" target="_blank">C# Listing on GitHub</a></font>&#160;</p>
<p>&#8211;</p>
<p><u>Result</u></p>
<p><img style="border-width:0;" border="0" alt="method-overloading_result" src="http://rtipton.files.wordpress.com/2009/11/method-overloading_result.jpg?w=444&#038;h=177" width="444" height="177" /></p>
<p>&#8211;</p>
<p>The main advantage of <a href="http://en.wikipedia.org/wiki/Method_overloading">Method Overloading</a> is code readability. Programming languages that do not allow <a href="http://en.wikipedia.org/wiki/Method_overloading">Method Overloading</a> require the developer to create totally separate methods for each variation of the input.&#160; <a href="http://www.blackwasp.co.uk/CSharpMethodOverloading.aspx" target="_blank">Blackwasp Consulting states</a> the following example:<em> in the ANSI C programming language to truncate a value you would use trunc, truncf or truncl according to the data type being rounded.&#160; In C#, method overloading allows you to always call Math.Truncate.</em></p>
<p>&#8211;</p>
<p><strong>Additional Information</strong></p>
<ul>
<li><a href="http://www.blackwasp.co.uk/CSharpMethodOverloading.aspx">C# Method Overloading &#8211; BlackWasp Consulting</a> </li>
<li><a href="http://arcware.net/guidelines-for-method-overloading/">Guidelines for Method Overloading &#8211; Dave Donaldson</a> </li>
<li><a href="http://csharp.net-tutorials.com/classes/method-overloading/">Method overloading &#8211; CSharp .Net-tutorials</a> </li>
<li><a href="http://www.codersource.net/csharp_method_overloading_ed.html">Method overloading in C# .Net &#8211; Coder Source</a> </li>
</ul>
<p>&#8211;</p>
<p>^..^</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1275&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2009/11/27/method-overloading/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/method-overloading_result.jpg" medium="image">
			<media:title type="html">method-overloading_result</media:title>
		</media:content>
	</item>
		<item>
		<title>Timers in .NET</title>
		<link>http://rhondatipton.net/2009/11/06/timers-in-net/</link>
		<comments>http://rhondatipton.net/2009/11/06/timers-in-net/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 13:50:36 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2009/11/06/timers-in-net/</guid>
		<description><![CDATA[I was researching timers the other day and realized that there are three variations in the .NET Framework. The three types of timers are explained below. 1 &#8211; System.Timers.Timer The System.Timers.Timer class timer is considered a server-based timer that was designed and optimized for use in multithreaded environments. It can be accessed safely from multiple [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1229&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was researching timers the other day and realized that there are three variations in the .NET Framework.</p>
<p><img border="0" alt="stopwatch" src="http://rtipton.files.wordpress.com/2009/11/stopwatch.jpg?w=125&#038;h=168" width="125" height="168" /></p>
<p>The three types of timers are explained below.</p>
<p><strong>1 &#8211; System.Timers.Timer</strong></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx" target="_blank">System.Timers.Timer</a> class timer is considered a server-based timer that was designed and optimized for use in multithreaded environments. It can be accessed safely from multiple threads.</p>
<p><font size="2"><u>C# Program</u></font></p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Timers;

<span style="color:blue;">public class </span><span style="color:#2b91af;">Program
</span>{
  <span style="color:blue;">private static </span>System.Timers.<span style="color:#2b91af;">Timer </span>testTimer;

  <span style="color:blue;">public static void </span>Main(<span style="color:blue;">string</span>[] args)
  {
    testTimer = <span style="color:blue;">new </span>System.Timers.<span style="color:#2b91af;">Timer</span>(5000); <span style="color:green;">// 5 seconds
    </span>testTimer.Elapsed += <span style="color:blue;">new </span><span style="color:#2b91af;">ElapsedEventHandler</span>(OnTimerElapsed);

    testTimer.Interval = 5000;
    testTimer.Enabled = <span style="color:blue;">true</span>;

    <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;Press the enter key to stop the timer&quot;</span>);
    <span style="color:#2b91af;">Console</span>.ReadLine();

  }

  <span style="color:blue;">private static void </span>OnTimerElapsed(<span style="color:blue;">object </span>source, <span style="color:#2b91af;">ElapsedEventArgs </span>e)
  {
    <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;Timer elapsed at {0}&quot;</span>, e.SignalTime);
  }
}</pre>
<p><font size="1"><a href="http://gist.github.com/338441#file_system_timers_timer.cs" target="_blank">C# Listing on GitHub</a></font>&#160;</p>
<div>&#160;</div>
<p><u>Output</u></p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image.png?w=334&#038;h=167" width="334" height="167" /></p>
<p>&#8211;</p>
<p><strong>2 &#8211; System.Threading.Timer</strong></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.threading.timer%28VS.71%29.aspx" target="_blank">System.Threading.Timer</a> class timer uses a TimerCallBack Delegate to specify the associated methods. The methods do not execute in the thread that created the timer; they execute in a separate thread that is automatically allocated by the system.</p>
<p><font size="2"><u>C# Program</u></font></p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Threading;

<span style="color:blue;">class </span><span style="color:#2b91af;">Program
</span>{
  <span style="color:blue;">static void </span>Main()
  {
     <span style="color:#2b91af;">AutoResetEvent </span>reset = <span style="color:blue;">new </span><span style="color:#2b91af;">AutoResetEvent</span>(<span style="color:blue;">false</span>);
     <span style="color:#2b91af;">StatusChecker </span>status = <span style="color:blue;">new </span><span style="color:#2b91af;">StatusChecker</span>(5);

     <span style="color:green;">// Invoke methods for the timer via a Delegate
     </span><span style="color:#2b91af;">TimerCallback </span>timerDelegate = <span style="color:blue;">new </span><span style="color:#2b91af;">TimerCallback</span>(status.CheckStatus);

     <span style="color:green;">// Create a timer that signals the delegate to invoke
     // Check status after one second, and then every 1/4 second
     </span><span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;{0} Creating the timer.\n&quot;</span>,
         <span style="color:#2b91af;">DateTime</span>.Now.ToString(<span style="color:#a31515;">&quot;h:mm:ss.fff&quot;</span>));

     <span style="color:#2b91af;">Timer </span>stateTimer = <span style="color:blue;">new </span><span style="color:#2b91af;">Timer</span>(timerDelegate, reset, 1000, 250);

     <span style="color:green;">// When the auto reset executes, change to every 1/2 second
     </span>reset.WaitOne(5000, <span style="color:blue;">false</span>);
     stateTimer.Change(0, 500);
     <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;\nChanging the timer period.\n&quot;</span>);

     reset.WaitOne(5000, <span style="color:blue;">false</span>);
     stateTimer.Dispose();
     <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;\nDestroying the timer.&quot;</span>);
  }
}

<span style="color:blue;">class </span><span style="color:#2b91af;">StatusChecker
</span>{
  <span style="color:blue;">int </span>invokeCount, maxCount;

  <span style="color:blue;">public </span>StatusChecker(<span style="color:blue;">int </span>count)
  {
     invokeCount = 0;
     maxCount = count;
  }

    <span style="color:green;">// This method is called by the timer delegate.
  </span><span style="color:blue;">public void </span>CheckStatus(<span style="color:#2b91af;">Object </span>stateInfo)
  {
     <span style="color:#2b91af;">AutoResetEvent </span>autoEvent = (<span style="color:#2b91af;">AutoResetEvent</span>)stateInfo;
     <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&quot;{0} Checking status {1,2}.&quot;</span>,
         <span style="color:#2b91af;">DateTime</span>.Now.ToString(<span style="color:#a31515;">&quot;h:mm:ss.fff&quot;</span>),
         (++invokeCount).ToString());

     <span style="color:blue;">if </span>(invokeCount == maxCount)
     {
         <span style="color:green;">// Reset the counter and signal Main.
         </span>invokeCount = 0;
         autoEvent.Set();
     }
  }
}</pre>
<div id="codeSnippetWrapper"><font size="1"><a href="http://gist.github.com/338441" target="_blank">C# Listing on GitHub</a></font>&#160; </div>
<p><strong><em></em></strong></p>
<p><u>Output</u></p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image1.png?w=304&#038;h=259" width="304" height="259" /></p>
<p>&#8211;</p>
<p><strong>3 &#8211; Windows.Forms.Timer</strong></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx" target="_blank">Windows.Forms.Timer</a> class works synchronously with the Windows Form, so that it will not interrupt any operations. It initializes on the UI thread.</p>
<p><font size="2"><u>C# Program</u></font></p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Windows.Forms;

<span style="color:blue;">namespace </span>WindowsFormsTimer
{
  <span style="color:blue;">public class </span><span style="color:#2b91af;">Class1
  </span>{
     <span style="color:blue;">static </span>System.Windows.Forms.Timer theTimer =
         <span style="color:blue;">new </span>System.Windows.Forms.Timer();

     <span style="color:blue;">static int </span>alarmCounter = 1;
     <span style="color:blue;">static bool </span>exitFlag = <span style="color:blue;">false</span>;

      <span style="color:green;">// Timer raised method
      </span><span style="color:blue;">private static void </span>TimerEventProcessor(<span style="color:#2b91af;">Object </span>myObject,
          <span style="color:#2b91af;">EventArgs </span>myEventArgs)
      {
         theTimer.Stop();

         <span style="color:green;">// Displays a message box asking whether to continue to run the timer
         </span><span style="color:blue;">if </span>(MessageBox.Show(<span style="color:#a31515;">&quot;Continue running?&quot;</span>, <span style="color:#a31515;">&quot;Count is &quot; </span>+
             alarmCounter, MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             <span style="color:green;">// Restarts the timer and increments the counter
             </span>alarmCounter += 1;
             theTimer.Enabled = <span style="color:blue;">true</span>;
         }
         <span style="color:blue;">else
         </span>{
             <span style="color:green;">// Stops the timer
             </span>exitFlag = <span style="color:blue;">true</span>;
         }
     }

     <span style="color:blue;">public static int </span>Main()
     {
         <span style="color:green;">//Adds the event and the event handler for the method that will
         //process the timer event to the timer
         </span>theTimer.Tick += <span style="color:blue;">new </span><span style="color:#2b91af;">EventHandler</span>(TimerEventProcessor);

         <span style="color:green;">// Sets the timer interval to 5 seconds
         </span>theTimer.Interval = 2000;
         theTimer.Start();

         <span style="color:green;">// Runs the timer, and raises the event
         </span><span style="color:blue;">while </span>(exitFlag == <span style="color:blue;">false</span>)
         {
             <span style="color:green;">// Processes all the events in the queue
             </span>Application.DoEvents();
         }
         <span style="color:blue;">return </span>0;
     }
  }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p><font size="1"><a href="http://gist.github.com/338441#file_system_windows_forms_timer.cs" target="_blank">C# Listing on GitHub</a></font>&#160;&#160; </p>
<p><u>Output</u></p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image2.png?w=154&#038;h=95" width="154" height="95" />&#160; <img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image3.png?w=154&#038;h=95" width="154" height="95" />&#160; <img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2009/11/image4.png?w=154&#038;h=94" width="154" height="94" /></p>
<p>&#8211;</p>
<p>There are three choices for timers in .NET.&#160; It just depends on what you want to do.</p>
<p>&#8211;</p>
<p><strong>More Information</strong></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc164015.aspx" target="_blank">Comparing the Timer Classes in the .NET Framework Class Library</a> </li>
<li><a href="http://stackoverflow.com/questions/1416803/system-timers-timer-vs-system-threading-timer" target="_blank">System.Timers.Timer vs System.Threading.Timer</a> </li>
<li><a href="http://www.vbdotnetheaven.com/UploadFile/mahesh/TimerControl04262005033148AM/TimerControl.aspx#" target="_blank">Working with Timer Control in VB.NET</a> </li>
</ul>
<p>&#8211;</p>
<p>Until next time&#8230;</p>
<p>^..^</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1229&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2009/11/06/timers-in-net/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/stopwatch.jpg" medium="image">
			<media:title type="html">stopwatch</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/11/image4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>HDNUG &#8211; October/09 Meeting &#8211; Recap</title>
		<link>http://rhondatipton.net/2009/10/09/hdnug-october09-meeting-recap/</link>
		<comments>http://rhondatipton.net/2009/10/09/hdnug-october09-meeting-recap/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:51:48 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2009/10/09/hdnug-october09-meeting-recap/</guid>
		<description><![CDATA[I attended the Houston .NET User Group October &#8217;09 meeting last night. There was a good turnout of about 75-85 people in attendance. &#160;&#160;&#160;&#160;&#160; Announcements - Next month Zain Naboulsi will be presenting on Windows 7 for developers There is an upcoming ASP.NET User Group that will likely be on the 4th Tuesday of each [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1194&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I attended the <a href="http://www.hdnug.org" target="_blank">Houston .NET User Group</a> October &#8217;09 meeting last night. There was a good turnout of about 75-85 people in attendance. </p>
<p>&nbsp;<img style="border-width:0;" border="0" alt="hdnuglogo" src="http://rtipton.files.wordpress.com/2009/10/hdnuglogo.jpg?w=113&#038;h=84" width="113" height="84">&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p>Announcements -</p>
<ul>
<li>Next month <a href="http://blogs.msdn.com/zainnab/" target="_blank">Zain Naboulsi</a> will be presenting on Windows 7 for developers
<li>There is an upcoming ASP.NET User Group that will likely be on the 4th Tuesday of each month &#8211; no dates set yet</li>
</ul>
<p>Main topic -</p>
<p><img style="border-width:0;" border="0" alt="photo" src="http://rtipton.files.wordpress.com/2009/10/photo.jpg?w=170&#038;h=134" width="170" height="134"></p>
<p><a href="http://claudiolassala.spaces.live.com" target="_blank">Claudio Lassala</a> gave a great talk titled <em>Be a Professional Developer and Write Clean Code</em>. Below are some of the points covered.</p>
<ul>
<li>What is clean code? Elegant and efficient, can be read and enhanced, simple and direct, etc&#8230;
<li>Computers do not care what your code looks like
<li>Name variables so that you don&#8217;t need comments</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Instead of &#8211;
<p><font size="2"><font face="Courier New"><font color="#008000">&nbsp;&nbsp;&nbsp;&nbsp; //Setting employee&#8217;s first name</font><br /><font color="#004080">&nbsp;&nbsp;&nbsp;&nbsp; string</font> field1 = <font color="#800000">&#8220;Rhonda&#8221;</font></font></font> ;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Use this &#8211;
<p><font size="2" face="Courier New"><font color="#004080">&nbsp;&nbsp;&nbsp;&nbsp; string</font> employeeFirstName = <font color="#800000">&#8220;Rhonda&#8221;</font>;</font></p>
<ul>
<li>If you have source control, there is no reason to keep code commented
<li><a href="http://www.ndepend.com/" target="_blank">NDepend</a> &#8211; a good tool that provides metrics for your code
<li>Functions should do one thing and do it well
<li>Vertical Distance &#8211; Declare variables close to where they are used. There is no need to declare all variables at the top of the program.</li>
</ul>
<p>Presentation Materials for <a href="http://claudiolassala.spaces.live.com/Blog/cns!E2A4B22308B39CD2!2257.entry" target="_blank">Be a Professional Developer and Write Clean Code</a>
<p>There were a lot more great points, but I had to leave before Claudio was finished. He did a great job of explaining how bad code should be rewritten.
<p><a href="http://rtipton.files.wordpress.com/2009/10/hdnug1.jpg" target="_blank"><img style="border-width:0;" border="0" alt="hdnug" src="http://rtipton.files.wordpress.com/2009/10/hdnug_thumb1.jpg?w=260&#038;h=200" width="260" height="200"></a>
<p>Looking for a user group meeting to attend? Check out my <a href="http://rtipton.wordpress.com/houston-user-groups/" target="_blank">Houston Tech Groups and Events</a> page.
<p>&#8211;
<p>Until next time&#8230;
<p>^..^ </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&amp;blog=148560&amp;post=1194&amp;subd=rtipton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2009/10/09/hdnug-october09-meeting-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rtipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/10/hdnuglogo.jpg" medium="image">
			<media:title type="html">hdnuglogo</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/10/photo.jpg" medium="image">
			<media:title type="html">photo</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2009/10/hdnug_thumb1.jpg" medium="image">
			<media:title type="html">hdnug</media:title>
		</media:content>
	</item>
	</channel>
</rss>
