<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blog.dotnetstyling.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>DotNetStyling</title><link>http://blog.dotnetstyling.com/blogs/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Be aware of deep copy with Collection&lt;T&gt;(IList&lt;T&gt;)</title><link>http://blog.dotnetstyling.com/archive/2009/03/19/be-aware-of-deep-copy-with-collection-t-ilist-t.aspx</link><pubDate>Thu, 19 Mar 2009 08:36:05 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:5794</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>Usually when I need to create a copy of some primitive type collection based on List&amp;lt;T&amp;gt; usually I use overload constructor of List class such as List&amp;lt;T&amp;gt;(IEnumerable&amp;lt;T&amp;gt;). It basically creates a new List&amp;lt;T&amp;gt; collection and populates the items based on IEnumerable&amp;lt;T&amp;gt; input parameter. Copied version is isolated from the original one which means changes made in copied version will not effect the original one. Recently I had the same task but instead of List&amp;lt;T&amp;gt; I had...(&lt;a href="http://blog.dotnetstyling.com/archive/2009/03/19/be-aware-of-deep-copy-with-collection-t-ilist-t.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=5794" width="1" height="1"&gt;</description></item><item><title>C# 3.0 Features. Part IV: Anonymous Types</title><link>http://blog.dotnetstyling.com/archive/2008/08/21/c-3-0-features-part-iv-anonymous-types.aspx</link><pubDate>Thu, 21 Aug 2008 09:06:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:5783</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>1</slash:comments><description>Previous materials of C# 3.0 Feature series: Part 1 - C# 3.0 Features. Part I: Auto Property Part 2 - C# 3.0 Features. Part II: Object and Collection Initialization Part 3 - C# 3.0 Features. Part III: The var keyword "Dynamic" Classes Anonymous Type is basically the C# way how we can dynamically create, populate and use a class without type declaration. If for some reason we need temporary classes as data carrier without any business logic implementation then Anonymous Types could be the perfect...(&lt;a href="http://blog.dotnetstyling.com/archive/2008/08/21/c-3-0-features-part-iv-anonymous-types.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=5783" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category></item><item><title>C# 3.0 Features. Part III: The var keyword</title><link>http://blog.dotnetstyling.com/archive/2008/08/07/c-3-0-features-part-iii-the-var-keyword.aspx</link><pubDate>Thu, 07 Aug 2008 11:58:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:5781</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>2</slash:comments><description>Previous materials of C# 3.0 Feature series: Part 1 - C# 3.0 Features. Part I: Auto Property Part 2 - C# 3.0 Features. Part II: Object and Collection Initialization “var” keyword During the local variable declaration we have to explicitly specify the type even if the variable doesn’t have any value yet. The “var” expression brings as ability do not specify the type during local variable declaration. The compiler will get it from the initializer. Let’s declare two local variables of the same type...(&lt;a href="http://blog.dotnetstyling.com/archive/2008/08/07/c-3-0-features-part-iii-the-var-keyword.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=5781" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category></item><item><title>C# 3.0 Features. Part II: Object and Collection Initialization</title><link>http://blog.dotnetstyling.com/archive/2008/08/04/c-3-0-features-part-ii-object-and-collection-initialization.aspx</link><pubDate>Mon, 04 Aug 2008 08:28:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:5779</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>0</slash:comments><description>Previous materials of C# 3.0 Feature series: Part 1 - C# 3.0 Features. Part I: Auto Property Object Initialization New object initialization technique gives us ability to define and fill the public property of the object on the fly. This expression was created to support LINQ but it can be used anywhere. This expression helps to fill values during the initialization and keep constructor empty. 1: public enum Sex { Male, Female } 2: &amp;#160; 3: public class User 4: { 5: public int UserId { get; private...(&lt;a href="http://blog.dotnetstyling.com/archive/2008/08/04/c-3-0-features-part-ii-object-and-collection-initialization.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=5779" width="1" height="1"&gt;</description></item><item><title>C# 3.0 Features. Part I: Auto Property</title><link>http://blog.dotnetstyling.com/archive/2008/07/31/c-3-0-features-part-i-auto-property.aspx</link><pubDate>Thu, 31 Jul 2008 09:47:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:5778</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>5</slash:comments><description>&amp;#160; I would like to continue my blogging experience with a series of blog posts related to C# 3.0 features. Although there are already a lot of materials regarding this subject in .Net community my impression is so strong that it forces me write about it. I decided to post simple blog per feature. The first one in the list is “Auto Property” &amp;#160; Redundancy in Property Declaration Usually, we use properties as data carrier which do not contain any business logic inside. This especially visible...(&lt;a href="http://blog.dotnetstyling.com/archive/2008/07/31/c-3-0-features-part-i-auto-property.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=5778" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category></item><item><title>How to Create Plugin for Windows Live Writer? Simple Content Source.</title><link>http://blog.dotnetstyling.com/archive/2007/11/29/how-to-create-plug-in-for-windows-live-writer-simple-content-source.aspx</link><pubDate>Thu, 29 Nov 2007 10:16:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:85</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>1</slash:comments><description>Windows Live Writer gives capability to extend functionality by creating new plug-ins. What I will demonstrate here is how to create content source plug-in which inserts custom formatted content. There are two types of content sources available in writer: Simple Content Source Smart Content Source Simple Content Source: Enables to insert custom HTML code to the post. Smart Content Source: Enables to insert custom HTML content with "smart" editing capabilities, such as include atomic selection, two-way...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/11/29/how-to-create-plug-in-for-windows-live-writer-simple-content-source.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=85" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Windows+Live+Writer/default.aspx">Windows Live Writer</category></item><item><title>Abstract Factory Design Pattern</title><link>http://blog.dotnetstyling.com/archive/2007/11/25/Abstract-Factory-Design-Pattern.aspx</link><pubDate>Sun, 25 Nov 2007 21:28:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:82</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>3</slash:comments><description>Abstract Factory provides interface for creating set of objects without specifying concrete implementation. Abstract Factory uses abstract classes and decouples concrete implementation from the system.  It brings flexibility to easily...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/11/25/Abstract-Factory-Design-Pattern.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=82" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blog.dotnetstyling.com/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>Passing Parameter by Value and by Reference ("ref"). CLR Internals</title><link>http://blog.dotnetstyling.com/archive/2007/11/22/passing-parameter-by-value-and-by-reference-ref-clr-internals.aspx</link><pubDate>Thu, 22 Nov 2007 20:35:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:81</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>0</slash:comments><description>What is the difference between passing parameter by reference (using "ref" keyword) and by value (without using "ref" keyword)? This is really nice and advance question which demonstrates understanding of .Net internals, especially relationship between Stack and Heap. Reference Type Let's make some demonstration and examine behavior and difference between passing reference type object by value and by reference. First let's create some custom class which we will use in demonstration. public class...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/11/22/passing-parameter-by-value-and-by-reference-ref-clr-internals.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=81" width="1" height="1"&gt;</description></item><item><title>Append new line in StringBuilder: AppendLine, AppendFormatLine, JavaScriptBuilder</title><link>http://blog.dotnetstyling.com/archive/2007/11/13/append-new-line-in-stringbuilder-appendline-appendformatline-javascriptbuilder.aspx</link><pubDate>Tue, 13 Nov 2007 09:57:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:72</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>4</slash:comments><description>It is a common technique in ASP.NET to generate JavaScript code from the web page's code behind file (.aspx.cs, .aspx.vb). Unfortunately it is a problem to read and sustain rendered JavaScript code because it usually renders all JavaScript code in one line. So, to have it readable developer tries to break those lines to have code a little bit more readable. But downside is more "mess" in code which builds JavaScript. Before I'll continue I hope you are familiar that the best and the fastest way how...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/11/13/append-new-line-in-stringbuilder-appendline-appendformatline-javascriptbuilder.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=72" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Issue of Rendering JavaScript in WebControls</title><link>http://blog.dotnetstyling.com/archive/2007/11/05/issue-of-rendering-javascript-in-webcontrols.aspx</link><pubDate>Mon, 05 Nov 2007 08:42:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:69</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>1</slash:comments><description>Originally I was not planning to post this subject until I spent hours for hunting some ghost JavaScript code. Problem was in generating custom JavaScript inside of WebControl. Basically this is not about "How" to generate JavaScript code but "When". Unfortunately I faced to this problem several times and all the time it was a cause for some JavaScript bug. Issue During WebControl implementation developers used to register all necessary JavaScript code inside of OnLoad method. For instance: private...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/11/05/issue-of-rendering-javascript-in-webcontrols.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=69" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/Web+Controls/default.aspx">Web Controls</category></item><item><title>Explicit Interface Implementation</title><link>http://blog.dotnetstyling.com/archive/2007/10/29/explicit-interface-implementation.aspx</link><pubDate>Mon, 29 Oct 2007 00:03:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:60</guid><dc:creator>Armen Ayvazyan</dc:creator><slash:comments>3</slash:comments><description>Explicit interface implementation helps to ensure that user can use methods define by a given interface using by correct interface reference....(&lt;a href="http://blog.dotnetstyling.com/archive/2007/10/29/explicit-interface-implementation.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=60" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>How fast StringBuilder is ?</title><link>http://blog.dotnetstyling.com/archive/2007/10/27/How-fast-SringBuilder-is.aspx</link><pubDate>Sat, 27 Oct 2007 01:20:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:55</guid><dc:creator>admin</dc:creator><slash:comments>5</slash:comments><description>Blog post explains why different approaches of string building perform faster than others. There is a sample application which measures speed of those approaches. How specifying capacity of StringBuilder during its instantiation increase a performance?...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/10/27/How-fast-SringBuilder-is.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=55" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/CLR/default.aspx">CLR</category></item><item><title>Optimal String Comparison</title><link>http://blog.dotnetstyling.com/archive/2007/10/04/Optimal-String-Comparison.aspx</link><pubDate>Thu, 04 Oct 2007 08:08:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:46</guid><dc:creator>admin</dc:creator><slash:comments>1</slash:comments><description>There are several ways how to compare two strings in .Net but not all of them have similar performance impact. The blog post describes why certain methods work slowly and which comparison tool is the optimal to use in .Net....(&lt;a href="http://blog.dotnetstyling.com/archive/2007/10/04/Optimal-String-Comparison.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=46" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/Tip+and+Trick/default.aspx">Tip and Trick</category><category domain="http://blog.dotnetstyling.com/archive/tags/CLR/default.aspx">CLR</category></item><item><title>Decorator Pattern</title><link>http://blog.dotnetstyling.com/archive/2007/09/27/Decorator-Pattern.aspx</link><pubDate>Thu, 27 Sep 2007 07:08:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:40</guid><dc:creator>admin</dc:creator><slash:comments>6</slash:comments><description>One of the beautiful patterns in GOF's (Gang Of Four) bucket is a Decorator Pattern. The purpose of Decorator pattern is to add extended functionality to the class without making any change in it. The blog describes architecture and has sample which shows pattern in work. ...(&lt;a href="http://blog.dotnetstyling.com/archive/2007/09/27/Decorator-Pattern.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=40" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blog.dotnetstyling.com/archive/tags/Architecture/default.aspx">Architecture</category></item><item><title>Custom Type Conversion</title><link>http://blog.dotnetstyling.com/archive/2007/09/14/Custom-Type-Conversion.aspx</link><pubDate>Fri, 14 Sep 2007 09:22:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:36</guid><dc:creator>admin</dc:creator><slash:comments>5</slash:comments><description>Blog post shows how to create Explicit and Implicit conversion (not casting) for two different classes....(&lt;a href="http://blog.dotnetstyling.com/archive/2007/09/14/Custom-Type-Conversion.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=36" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Nullable value type variables.</title><link>http://blog.dotnetstyling.com/archive/2007/08/03/nullable-value-type-variables.aspx</link><pubDate>Fri, 03 Aug 2007 14:31:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:31</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;P&gt;.Net Framework 2.0 brought us&amp;nbsp;ability of having nullable value type variables. Maybe it sounds unusually but there are cases where we could use this feature. To make it happen we have to put "?" mark&amp;nbsp;operator after the type, like this:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;bool&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;? booleanvalue = &lt;SPAN style="COLOR:blue;"&gt;null&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;? integervalue = &lt;SPAN style="COLOR:blue;"&gt;null&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;SPAN style="FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;short&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;? GetShortValue()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;null&lt;/SPAN&gt;; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;SPAN style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;SPAN style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now variables &lt;STRONG&gt;booleanvalue &lt;/STRONG&gt;and &lt;STRONG&gt;integervalue &lt;/STRONG&gt;have null value. And of course we can set&amp;nbsp;null value&amp;nbsp;in any part of code.&amp;nbsp;&lt;BR&gt;For example I could use this feature to create public property with lazy load initialization:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt;? _field;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt;? Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;if&lt;/SPAN&gt; (_field != &lt;SPAN style="COLOR:blue;"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_field = 10; &lt;SPAN style="COLOR:green;"&gt;//Default value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;return&lt;/SPAN&gt; _field;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;set&lt;/SPAN&gt; { _field = &lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We cannot set nullable type of variable to non nullable. We will get compile-time error.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;? integervalue = &lt;SPAN style="COLOR:blue;"&gt;3&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; standardInteger = integervalue; &lt;SPAN style="COLOR:green;"&gt;//This is wrong implementation&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To achieve that we have to use new "??" operator.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;? integervalue = &lt;SPAN style="COLOR:blue;"&gt;null&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; y = integervalue ?? 3;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case&amp;nbsp;when &lt;STRONG&gt;integervalue &lt;/STRONG&gt;will have &lt;STRONG&gt;null &lt;/STRONG&gt;value &lt;STRONG&gt;y&lt;/STRONG&gt;&amp;nbsp;variable will set to &lt;STRONG&gt;3&lt;/STRONG&gt; otherwise to &lt;STRONG&gt;integervalue.&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=31" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Commerce Server 2007</title><link>http://blog.dotnetstyling.com/archive/2007/08/03/commerce-server-2007.aspx</link><pubDate>Fri, 03 Aug 2007 10:29:05 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:30</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Commerce Server 2007 is a huge and powerful application&amp;nbsp;but it is&amp;nbsp;a problem to find documentation or material about it. Including the fact that there are not so many&amp;nbsp;people working&amp;nbsp;on Commerce Server 2007,&amp;nbsp;it is a new product and&amp;nbsp;there is no book, it should be a problem to start&amp;nbsp;implementation.&lt;/p&gt; &lt;p&gt;Nikola Malovic has a couple of awesome posts on his blog site &lt;a title="blog.vuscode.com" href="http://blog.vuscode.com/tags/Commerce+Server+2007/default.aspx" target="_blank"&gt;blog.vuscode.com&lt;/a&gt;&amp;nbsp;about Commerce Server 2007. Follow the link and check them out.&amp;nbsp;&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=30" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Products/default.aspx">Products</category></item><item><title>How to Sort objects in collection. IComparer, IComparable</title><link>http://blog.dotnetstyling.com/archive/2007/08/03/how-to-sort-objects-in-collection-icomparer-icomparable.aspx</link><pubDate>Thu, 02 Aug 2007 22:43:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:29</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;P&gt;Probably you know about the &lt;STRONG&gt;IComparer&lt;/STRONG&gt; and &lt;STRONG&gt;IComparable&lt;/STRONG&gt; interfaces which bring us&amp;nbsp;ability to sort items inside of the collection. I would like to talk about&amp;nbsp;them as I know a&amp;nbsp;lot of developers getting confused during implementation sorting functionality.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;One dimensional sorting, IComparable.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IComparable&lt;/STRONG&gt; interface allow object to be sorted in collection based on some key. By inheriting object from &lt;STRONG&gt;IComparable&lt;/STRONG&gt; interface we are making object "comparable" to its type in collection. How it works?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IComparable&lt;/STRONG&gt; interface contains one public method &lt;STRONG&gt;CompareTo(object obj)&lt;/STRONG&gt; which we have to implement in our class. Let's say we have some class named Employee which contains information about company employee and looks like this :&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Employee
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; _id;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; Id
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt;{ &lt;SPAN&gt;return&lt;/SPAN&gt; _id;}
        }

        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt; _employeeName;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt; EmployeeName
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt; _employeeName; }
        }

        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt; _dateOfHire;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt; DateOfHire
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt; _dateOfHire; }
        }
    
        &lt;SPAN&gt;public&lt;/SPAN&gt; Employee(&lt;SPAN&gt;int&lt;/SPAN&gt; id, &lt;SPAN&gt;string&lt;/SPAN&gt; name, &lt;SPAN&gt;DateTime&lt;/SPAN&gt; dateOfHire)
        {
            _id = id;
            _employeeName = name;
            _dateOfHire = dateOfHire;
        }    
    }
}&lt;/PRE&gt;
&lt;P&gt;We have a simple class which contains three properties with different types: integer, string and datetime. Now let's us to make it "comparable" to have ability to sort it after. To achieve that we will inherit our class from &lt;STRONG&gt;IComparable&lt;/STRONG&gt; interface.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt; : &lt;SPAN&gt;&lt;STRONG&gt;IComparable&lt;/STRONG&gt;
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; _id;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; Id
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt;{ &lt;SPAN&gt;return&lt;/SPAN&gt; _id;}
        }

        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt; _employeeName;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt; EmployeeName
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt; _employeeName; }
        }

        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt; _dateOfHire;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt; DateOfHire
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt; _dateOfHire; }
        }
    
        &lt;SPAN&gt;public&lt;/SPAN&gt; Employee(&lt;SPAN&gt;int&lt;/SPAN&gt; id, &lt;SPAN&gt;string&lt;/SPAN&gt; name, &lt;SPAN&gt;DateTime&lt;/SPAN&gt; dateOfHire)
        {
            _id = id;
            _employeeName = name;
            _dateOfHire = dateOfHire;
        }

        &lt;STRONG&gt;&lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; Implementation of IComparble interface's compare method.
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;param name="obj"&amp;gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;Object which should be compared 
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; with the current one.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/param&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;returns&amp;gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;Returns the value which shows position of 
&lt;/SPAN&gt;        &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; object compare to current.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/returns&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; CompareTo(&lt;SPAN&gt;object&lt;/SPAN&gt; obj)
        {
            &lt;SPAN&gt;Employee&lt;/SPAN&gt; temp = (&lt;SPAN&gt;Employee&lt;/SPAN&gt;) obj;

            &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;this&lt;/SPAN&gt;.Id&amp;gt;temp.Id)
                &lt;SPAN&gt;return&lt;/SPAN&gt; 1;
            &lt;SPAN&gt;else&lt;/SPAN&gt; &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;this&lt;/SPAN&gt;.Id&amp;lt;temp.Id)
                &lt;SPAN&gt;return&lt;/SPAN&gt; -1;
            &lt;SPAN&gt;else&lt;/SPAN&gt; 
                &lt;SPAN&gt;return&lt;/SPAN&gt; 0;
        }&lt;/STRONG&gt;
    }
}&lt;/PRE&gt;
&lt;P&gt;As you can see, we implemented public &lt;STRONG&gt;CompareTo (object obj) &lt;/STRONG&gt;method&amp;nbsp;where input parameter &lt;STRONG&gt;obj&lt;/STRONG&gt; will be compared with the current type where returned value represents order compare to passed object, whether&amp;nbsp;it should be positioned before or after. Let's try it. In our Main method of our console application project we will create a collection, fill it by some Employee objects and then sort it.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Program
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;static&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Main(&lt;SPAN&gt;string&lt;/SPAN&gt;[] args)
        {
            &lt;SPAN&gt;Employee&lt;/SPAN&gt;[] employees =&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;[5];

            employees[0] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(5, &lt;SPAN&gt;"Jhon"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 7, 10));
            employees[1] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(2, &lt;SPAN&gt;"David"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 11, 23));
            employees[2] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(1, &lt;SPAN&gt;"Alex"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2004, 5, 4));
            employees[3] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(10, &lt;SPAN&gt;"Ann"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2005, 4, 9));
            employees[4] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(4, &lt;SPAN&gt;"Todd"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2003, 2, 18));

            &lt;STRONG&gt;&lt;SPAN&gt;Array&lt;/SPAN&gt;.Sort(employees);&lt;/STRONG&gt;

            &lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;Employee&lt;/SPAN&gt; employee &lt;SPAN&gt;in&lt;/SPAN&gt; employees)
            {
                &lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN&gt;"Id={0} : Name={1} : DateOfHire={2}"&lt;/SPAN&gt;,
                                  employee.Id,
                                  employee.EmployeeName,
                                  employee.DateOfHire.ToShortDateString());
            }

            &lt;SPAN&gt;Console&lt;/SPAN&gt;.Read();
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;As you can&amp;nbsp;see we added 5 Employee objects into the collection&amp;nbsp;and before&amp;nbsp;writing them out we used static Sort() method of Array class and passed there our collection like input parameter. Thanks that our&amp;nbsp;class was inherited from &lt;STRONG&gt;IComparable&lt;/STRONG&gt; Sort method run CompareTo method of Employee class with our implementation. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_2.png" target=_blank&gt;&lt;IMG style="BORDER-TOP-WIDTH:0px;BORDER-LEFT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;" height=214 alt=image src="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_thumb_1.png" width=458 border=0&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And as you can see the result output have been sorted by Id of Employee even we added object with mixed order. This is called as &lt;STRONG&gt;one dimensional sorting&lt;/STRONG&gt; as it is sorting just by Id property and with Ascending order. But what if we want to change the order of sorting or to change the property which should be used for compare. Now it is a time to look into the &lt;STRONG&gt;IComparer &lt;/STRONG&gt;interface.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Multidimensional sorting, IComparer.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;To achieve the goal we have to implement class with &lt;STRONG&gt;ICompare&lt;/STRONG&gt; interface. Usually, &lt;STRONG&gt;ICompare&lt;/STRONG&gt; is not implemented on a class which should be sorted but on external helper class. So, it is the time to create our own comparer class:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt; : System.Collections.&lt;SPAN&gt;IComparer
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; Compare(&lt;SPAN&gt;object&lt;/SPAN&gt; x, &lt;SPAN&gt;object&lt;/SPAN&gt; y)
        {
            &lt;SPAN&gt;Employee&lt;/SPAN&gt; tempx = (&lt;SPAN&gt;Employee&lt;/SPAN&gt;) x;
            &lt;SPAN&gt;Employee&lt;/SPAN&gt; tempy = (&lt;SPAN&gt;Employee&lt;/SPAN&gt;) y;

            &lt;SPAN&gt;return&lt;/SPAN&gt; tempx.Id.CompareTo(tempy.Id);
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;As you can see we created EmployeeComparer class inherited from &lt;STRONG&gt;IComparer&lt;/STRONG&gt; and what we just need to implement &lt;STRONG&gt;Compare()&lt;/STRONG&gt; method brought by interface. By the way &lt;STRONG&gt;ICompare&lt;/STRONG&gt; is part of &lt;STRONG&gt;System.Collections&lt;/STRONG&gt; namespace. In current implementation compare class will bring us the same result as the previous example with IComparable implementation. How to use it? Basically with the same way:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Program
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;static&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Main(&lt;SPAN&gt;string&lt;/SPAN&gt;[] args)
        {
            &lt;SPAN&gt;Employee&lt;/SPAN&gt;[] employees =&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;[5];

            employees[0] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(5, &lt;SPAN&gt;"Jhon"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 7, 10));
            employees[1] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(2, &lt;SPAN&gt;"David"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 11, 23));
            employees[2] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(1, &lt;SPAN&gt;"Alex"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2004, 5, 4));
            employees[3] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(10, &lt;SPAN&gt;"Ann"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2005, 4, 9));
            employees[4] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(4, &lt;SPAN&gt;"Todd"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2003, 2, 18));

            &lt;SPAN&gt;Array&lt;/SPAN&gt;.Sort(employees, &lt;STRONG&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;());&lt;/STRONG&gt;

            &lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;Employee&lt;/SPAN&gt; employee &lt;SPAN&gt;in&lt;/SPAN&gt; employees)
            {
                &lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN&gt;"Id={0} : Name={1} : DateOfHire={2}"&lt;/SPAN&gt;,
                                  employee.Id,
                                  employee.EmployeeName,
                                  employee.DateOfHire.ToShortDateString());
            }

            &lt;SPAN&gt;Console&lt;/SPAN&gt;.Read();
        }
    }
}&lt;/PRE&gt;&lt;PRE class=code&gt;In Sort method along with collection parameter we are passing comparer object.&lt;/PRE&gt;&lt;PRE class=code&gt;As you can see we have the same result as in the with the IComparable:&lt;/PRE&gt;&lt;PRE class=code&gt;&lt;A href="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_2.png" target=_blank&gt;&lt;IMG style="BORDER-TOP-WIDTH:0px;BORDER-LEFT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;" height=214 alt=image src="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_thumb_1.png" width=458 border=0&gt;&lt;/A&gt; &lt;/PRE&gt;&lt;PRE class=code&gt;&amp;nbsp;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;But now all our attention should switch to EmployeeComparer implementation. Lets add two public enumerations and two public properties which will hold the enumeration value into the comparer class: &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt; : System.Collections.&lt;SPAN&gt;IComparer
&lt;/SPAN&gt;    {
        &lt;STRONG&gt;&lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;enum&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;SortDirection
&lt;/SPAN&gt;        {
            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; Ascending
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;            Asc,
            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; Descending
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;            Desc
        }

        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;enum&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;SortingProperty
&lt;/SPAN&gt;        {
            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; EmployeeId
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;            id,
            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; Employee name
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;            name,
            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;summary&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt; Date when employee was hired.
&lt;/SPAN&gt;            &lt;SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;lt;/summary&amp;gt;
&lt;/SPAN&gt;            date
        }
&lt;/STRONG&gt;
       &lt;STRONG&gt; &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;SortDirection&lt;/SPAN&gt; _sortOrder = &lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Asc;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;SortDirection&lt;/SPAN&gt; SortOrder
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt; _sortOrder; }
            &lt;SPAN&gt;set&lt;/SPAN&gt; { _sortOrder = &lt;SPAN&gt;value&lt;/SPAN&gt;;}
        }

        &lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt; _sortBy = &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.id;
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt; SortBy
        {
            &lt;SPAN&gt;get&lt;/SPAN&gt; { &lt;SPAN&gt;return&lt;/SPAN&gt;  _sortBy; }
            &lt;SPAN&gt;set&lt;/SPAN&gt; { _sortBy = &lt;SPAN&gt;value&lt;/SPAN&gt;; }
        }&lt;/STRONG&gt;
    

        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;int&lt;/SPAN&gt; Compare(&lt;SPAN&gt;object&lt;/SPAN&gt; x, &lt;SPAN&gt;object&lt;/SPAN&gt; y)
        {
            &lt;STRONG&gt;&lt;SPAN&gt;int&lt;/SPAN&gt; compareValue = 0;&lt;/STRONG&gt;

            &lt;SPAN&gt;Employee&lt;/SPAN&gt; tempx = (&lt;SPAN&gt;Employee&lt;/SPAN&gt;) x;
            &lt;SPAN&gt;Employee&lt;/SPAN&gt; tempy = (&lt;SPAN&gt;Employee&lt;/SPAN&gt;) y;

           &lt;STRONG&gt; &lt;SPAN&gt;switch&lt;/SPAN&gt;(_sortBy)
            {
                &lt;SPAN&gt;case&lt;/SPAN&gt; &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.id :
                    {
                        &lt;SPAN&gt;if&lt;/SPAN&gt; (_sortOrder == &lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Asc)
                            compareValue = tempx.Id.CompareTo(tempy.Id);
                        &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;else
&lt;/SPAN&gt;                            compareValue = tempy.Id.CompareTo(tempx.Id);    
                        &lt;SPAN&gt;break&lt;/SPAN&gt;;
                    }
                &lt;SPAN&gt;case&lt;/SPAN&gt; &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.name :
                    {
                        &lt;SPAN&gt;if&lt;/SPAN&gt; (_sortOrder == &lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Asc)
                            compareValue = tempx.EmployeeName.CompareTo(tempy.EmployeeName);
                        &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;else
&lt;/SPAN&gt;                            compareValue = tempy.EmployeeName.CompareTo(tempx.EmployeeName);

                        &lt;SPAN&gt;break&lt;/SPAN&gt;;
                    }
                &lt;SPAN&gt;case&lt;/SPAN&gt; &lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.date:
                    {
                        &lt;SPAN&gt;if&lt;/SPAN&gt; (_sortOrder == &lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Asc)
                            compareValue = tempx.DateOfHire.CompareTo(tempy.DateOfHire);
                        &lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;else
&lt;/SPAN&gt;                            compareValue = tempy.DateOfHire.CompareTo(tempx.DateOfHire);

                        &lt;SPAN&gt;break&lt;/SPAN&gt;;
                    }

            }&lt;/STRONG&gt;

            &lt;SPAN&gt;return&lt;/SPAN&gt; &lt;STRONG&gt;compareValue&lt;/STRONG&gt;; 
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;As you see, we have now implemented object compare by all three properties and in both orders (ASC, DESC). Let's&amp;nbsp;now use them:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Program
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;static&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Main(&lt;SPAN&gt;string&lt;/SPAN&gt;[] args)
        {
            &lt;SPAN&gt;Employee&lt;/SPAN&gt;[] employees =&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;[5];

            employees[0] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(5, &lt;SPAN&gt;"Jhon"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 7, 10));
            employees[1] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(2, &lt;SPAN&gt;"David"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 11, 23));
            employees[2] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(1, &lt;SPAN&gt;"Alex"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2004, 5, 4));
            employees[3] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(10, &lt;SPAN&gt;"Ann"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2005, 4, 9));
            employees[4] = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(4, &lt;SPAN&gt;"Todd"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2003, 2, 18));

           &lt;STRONG&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt; ec = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;();
            ec.SortBy = &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.name;
            ec.SortOrder = &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Desc;&lt;/STRONG&gt;

            &lt;SPAN&gt;Array&lt;/SPAN&gt;.Sort(employees, &lt;STRONG&gt;ec&lt;/STRONG&gt;);

            &lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;Employee&lt;/SPAN&gt; employee &lt;SPAN&gt;in&lt;/SPAN&gt; employees)
            {
                &lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN&gt;"Id={0} : Name={1} : DateOfHire={2}"&lt;/SPAN&gt;,
                                  employee.Id,
                                  employee.EmployeeName,
                                  employee.DateOfHire.ToShortDateString());
            }

            &lt;SPAN&gt;Console&lt;/SPAN&gt;.Read();
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Before sorting we created new instance of EmployeeCompare object and set the sorting order and property to appropriate values.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_3.png" target=_blank&gt;&lt;IMG style="BORDER-TOP-WIDTH:0px;BORDER-LEFT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;" height=174 alt=image src="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_thumb_2.png" width=482 border=0&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Try to change sorting criteria and you will see the appropriate result on a screen. Well, basically that's it. :)&amp;nbsp;As you see&amp;nbsp;nothing special in it. &lt;/P&gt;
&lt;P&gt;Ok, but what about having custom collection based on ArrayList class. Do we need to sort it throw Array.Sort() method ? Let's see. First we will create collection class. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System.Collections;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeCollection&lt;/SPAN&gt; : &lt;SPAN&gt;ArrayList
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Add(&lt;SPAN&gt;Employee&lt;/SPAN&gt; employee)
        {
            &lt;SPAN&gt;base&lt;/SPAN&gt;.Add(employee);
        }

        &lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Sort(&lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortingProperty&lt;/SPAN&gt; sp,
            &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortDirection&lt;/SPAN&gt; sd)
        {
            &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt; ec = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;();
            ec.SortBy = sp;
            ec.SortOrder = sd;

            &lt;SPAN&gt;base&lt;/SPAN&gt;.Sort(ec);
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Now we will replace the code in the Main method to have EmployeeCollection instead of Employee array. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN&gt;using&lt;/SPAN&gt; System;

&lt;SPAN&gt;namespace&lt;/SPAN&gt; SortingObjectsInCollecton
{
    &lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;Program
&lt;/SPAN&gt;    {
        &lt;SPAN&gt;static&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Main(&lt;SPAN&gt;string&lt;/SPAN&gt;[] args)
        {
            &lt;SPAN&gt;EmployeeCollection&lt;/SPAN&gt; employees = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;EmployeeCollection&lt;/SPAN&gt;();
            employees.Add(&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(5, &lt;SPAN&gt;"Jhon"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 7, 10)));
            employees.Add(&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(2, &lt;SPAN&gt;"David"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2006, 11, 23)));
            employees.Add(&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(1, &lt;SPAN&gt;"Alex"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2004, 5, 4)));
            employees.Add(&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(10, &lt;SPAN&gt;"Ann"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2005, 4, 9)));
            employees.Add(&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Employee&lt;/SPAN&gt;(4, &lt;SPAN&gt;"Todd"&lt;/SPAN&gt;, &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;DateTime&lt;/SPAN&gt;(2003, 2, 18)));

            employees.Sort(&lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortingProperty&lt;/SPAN&gt;.name,
                           &lt;SPAN&gt;EmployeeComparer&lt;/SPAN&gt;.&lt;SPAN&gt;SortDirection&lt;/SPAN&gt;.Desc);

            &lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;Employee&lt;/SPAN&gt; employee &lt;SPAN&gt;in&lt;/SPAN&gt; employees)
            {
                &lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN&gt;"Id={0} : Name={1} : DateOfHire={2}"&lt;/SPAN&gt;,
                                  employee.Id,
                                  employee.EmployeeName,
                                  employee.DateOfHire.ToShortDateString());
            }

            &lt;SPAN&gt;Console&lt;/SPAN&gt;.Read();
        }
    }
}
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;And us you can see the result is the same but with different implementation.&lt;/P&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;&lt;A href="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_3.png" target=_blank&gt;&lt;IMG style="BORDER-TOP-WIDTH:0px;BORDER-LEFT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;" height=174 alt=image src="http://blog.dotnetstyling.com/blogs/dotnetworld/WindowsLiveWriter/HowtoSortobjectsincollection_E833/image_thumb_2.png" width=482 border=0&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Than's it.&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Basically that's it. As you can see nothing special. Really easy. I'll try in a future to make some&amp;nbsp;blog about sorting of Generic objects. Hopefully this blog will help you to implement "Sorting" functionality.&lt;/P&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=29" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Visual Studio 2008 Beta 2</title><link>http://blog.dotnetstyling.com/archive/2007/07/27/visual-studio-2008-beta-2.aspx</link><pubDate>Fri, 27 Jul 2007 09:03:38 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:27</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Visual Studio 2008 Beta 2 is now available on MSDN web site :). Follow the link, pick&amp;nbsp;the edition and download it.&lt;/p&gt; &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx"&gt;Download Visual Studio 2008 Beta 2&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=27" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Family.Show 2.0</title><link>http://blog.dotnetstyling.com/archive/2007/07/23/family-show-2-0.aspx</link><pubDate>Sun, 22 Jul 2007 20:58:12 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:25</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Version 2.0 of Family.Show application which is an&amp;nbsp;incredible example of WPF technology now available. You can download it at&amp;nbsp;Vertigo&amp;nbsp;website &lt;a href="http://www.vertigo.com/familyshow.aspx" target="_blank"&gt;http://www.vertigo.com/familyshow.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;There are a couple of new features added to application:&lt;/p&gt; &lt;p&gt;· New “Family Data View” with filtering, sorting, and in-place editing&lt;/p&gt; &lt;p&gt;· Family Analytics including last name tag cloud, age distribution historgram and birthday list.  &lt;p&gt;· Enhanced story editing with support for font name, size, alignment, bullets,&amp;nbsp; and numerical lists &lt;p&gt;· Filtering and sorting the Family List view, in the main window &lt;p&gt;· More cowbell! &lt;p&gt;· Skinnable user interface with two skins: black and silver &lt;p&gt;· Improved Windsor family sample data file with stories and images.  &lt;p&gt;· Source code migrated to CodePlex &lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=25" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blog.dotnetstyling.com/archive/tags/Technology/default.aspx">Technology</category></item><item><title>ReSharper 3.0 has been released</title><link>http://blog.dotnetstyling.com/archive/2007/06/22/resharper-3-0-has-been-released.aspx</link><pubDate>Fri, 22 Jun 2007 07:59:56 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:22</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;JetBrains released next version of its awesome application ReSharper 3.0. &lt;/p&gt; &lt;p&gt;ReSharper is an add-in for Visual Studio which contains many features&amp;nbsp;for .Net application development.&amp;nbsp;It helps simplify the process&amp;nbsp;of writing a code. Ones I stared to use&amp;nbsp;ReSharper I cannot imagine&amp;nbsp;working without it after. It has many features but the&amp;nbsp;best from my&amp;nbsp;point of view is static code analyzer which&amp;nbsp; brings you errors or warnings on the fly without compilation. Another excellent feature is searching the objects&amp;nbsp;inside of solution which is much powerful and&amp;nbsp;has much better interface for doing that. &lt;/p&gt; &lt;p&gt;With the new version ReSharper supports XAML&amp;nbsp;and XML, offers C# code suggestion on the fly and much much more.&lt;/p&gt; &lt;p&gt;Just follow the link to check out all the features exist in ReSharper 3.0&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.jetbrains.com/resharper/features/index.html" target="_blank"&gt;http://www.jetbrains.com/resharper/features/index.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;To download a 30 days free trial version &lt;a href="http://www.jetbrains.com/resharper/download/index.html" target="_blank"&gt;click here&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=22" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blog.dotnetstyling.com/archive/tags/Add-in/default.aspx">Add-in</category></item><item><title>WPF in life</title><link>http://blog.dotnetstyling.com/archive/2007/06/19/wpf-in-life.aspx</link><pubDate>Tue, 19 Jun 2007 09:01:40 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:21</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This is a simple application which shows a power of Window Presentation Foundation. Just follow the link, download "ClickOnes" installation and have a fun. You gonna love it. :)&lt;/p&gt; &lt;p&gt;&lt;a title="WPF in life" href="http://www.vertigo.com/familyshow.aspx" target="_blank"&gt;http://www.vertigo.com/familyshow.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The most important part is that you can download the source code and investigate application structure.&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=21" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blog.dotnetstyling.com/archive/tags/Technology/default.aspx">Technology</category></item><item><title>Incredible future in IT world</title><link>http://blog.dotnetstyling.com/archive/2007/06/01/incredible-future-in-it-world.aspx</link><pubDate>Thu, 31 May 2007 15:31:01 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:20</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This is awesome. This is an incredible future of computer hardware. It's beeter to see than to talk about :)&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.microsoft.com/surface/" target="_blank"&gt;Microsoft Surface&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=20" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/Technology/default.aspx">Technology</category></item><item><title>How to create an Add-in for Visual Studio?</title><link>http://blog.dotnetstyling.com/archive/2007/04/24/how-to-create-an-add-in-for-visual-studio.aspx</link><pubDate>Mon, 23 Apr 2007 17:03:36 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:16</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;If you are planning to create&amp;nbsp;your own&amp;nbsp;Add-in for Visual Studio, I found a very good source written by &lt;strong&gt;Jon Rista - Writing a Visual Studio 2005 Add-in&lt;/strong&gt;.&lt;br&gt;Follow the link below and you'll see explanation and will have ability to download source code&amp;nbsp;(C#).&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.codeproject.com/useritems/LineCounterAddin.asp" href="http://www.codeproject.com/useritems/LineCounterAddin.asp"&gt;http://www.codeproject.com/useritems/LineCounterAddin.asp&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=16" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blog.dotnetstyling.com/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blog.dotnetstyling.com/archive/tags/Add-in/default.aspx">Add-in</category></item><item><title>ASP.NET: Monitoring of web page life cycle</title><link>http://blog.dotnetstyling.com/archive/2007/04/15/asp-net-monitoring-of-web-page-life-cycle.aspx</link><pubDate>Sat, 14 Apr 2007 20:47:00 GMT</pubDate><guid isPermaLink="false">5b0fd9f5-e499-434e-81d8-bae286ef57b6:14</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote simple code which is showing order of execution of events and protected methods related to the page life cycle.&lt;/P&gt;
&lt;P&gt;I simply added output messages into the&amp;nbsp; each event&amp;nbsp;and protected method&amp;nbsp;of Page and Control&amp;nbsp;(UserControl which is located&amp;nbsp;on that page). This is an example of how I did it:&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;protected void Page_Init(object sender, EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Container.messageCollection.Add("P: Page_Init");&lt;BR&gt;} 
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;protected override void OnInit(EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Container.messageCollection.Add("P: Before base.OnInit");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.OnInit(e);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Container.messageCollection.Add("P: After base.OnInit");&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;After filling a collection I just write messages out in order how they were added.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And this is an output result:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;1: P: Before base.OnPreInit&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;2: P: Page_PreInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;3: P: After base.OnPreInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;4: C: Before base.OnInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;5: C: Page_Init&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;6: C: After base.OnInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;7: P: Before base.OnInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;8: P: Page_Init&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;9: P: After base.OnInit&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;10: P: Before base.OnInitComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;11: P: Page_InitComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;12: P: After base.OnInitComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;13: P: Before base.OnPreLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;14: P: Page_PreLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;15: P: After base.OnPreLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;16: P: Before base.OnLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;17: P: Page_Load&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;18: P: After base.OnLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;19: C: Before base.OnLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;20: C: Page_Load&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;21: C: After base.OnLoad&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;22: P: Before base.OnLoadComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;23: P: Page_LoadComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;24: P: After base.OnLoadComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;25: P: Before base.OnPreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;26: P: Page_PreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;27: P: After base.OnPreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;28: C: Before base.OnPreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;29: C: Page_PreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;30: C: After base.OnPreRender&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;31: P: Before base.OnPreRenderComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;32: P: After base.OnPreRenderComplete&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;33: C: Before base.OnUnload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;34: C: Page_Unload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#ff0000&gt;35: C: After base.OnUnload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;36: P: Before base.OnUnload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;37: P: Page_Unload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;38: P: After base.OnUnload&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;
&lt;P&gt;First &lt;FONT color=#ff0000&gt;"C" letter or red color&lt;/FONT&gt; are messages from UserControl side. Messages with &lt;FONT color=#0000ff&gt;"P" letter or blue color&lt;/FONT&gt; represent&amp;nbsp;page level.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;So, now you can see an order how events in page and contol occur during page life cycle.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blog.dotnetstyling.com/aggbug.aspx?PostID=14" width="1" height="1"&gt;</description><category domain="http://blog.dotnetstyling.com/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blog.dotnetstyling.com/archive/tags/Controls/default.aspx">Controls</category></item></channel></rss>