<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-3828837637845216808</id><updated>2009-10-17T15:52:47.211+05:30</updated><title type='text'>VS 2008 by Mehul</title><subtitle type='html'>This Blog will provide you the information about new things introduced in Visual Studio 2008 and will also give the detail code of it so you can work with it.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-6768943653954561352</id><published>2008-09-06T23:13:00.001+05:30</published><updated>2008-09-06T23:13:30.535+05:30</updated><title type='text'>Finding which column belongs to which table from database MsSql</title><content type='html'>&lt;span xmlns=''&gt;&lt;p style='margin-left: 3pt'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333; font-family:Arial; font-size:10pt'&gt;Finding a column from the database&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333; font-family:Arial; font-size:10pt'&gt;select * from syscolumns where name ='empid'&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333; font-family:Arial; font-size:10pt'&gt;Finding an object from database&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333; font-family:Arial; font-size:10pt'&gt;Select * from sysobjects where name='employee'&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333; font-family:Arial; font-size:10pt'&gt;Finding the table name to which the column belongs&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;span style='color:#333333'&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;select * from sysobjects where id in(select id from syscolumns where name like'empid%'&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 3pt'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Getting displayed the columns and tables to gather &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Select a.name, b.name from sysobjects  a, syscolumns b&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Where a.id = b.id&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-6768943653954561352?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/6768943653954561352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=6768943653954561352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6768943653954561352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6768943653954561352'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/09/finding-which-column-belongs-to-which.html' title='Finding which column belongs to which table from database MsSql'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-8819749255128593410</id><published>2008-05-26T18:15:00.001+05:30</published><updated>2008-05-26T18:15:33.032+05:30</updated><title type='text'>Fuzzy Mathematics: Fuzzy Logic, Fuzzy Sets, Fuzzy Numbers.</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In this Chapter we will take a good long look at fuzzy logic, and a brief look at fuzzy sets and fuzzy numbers. (Later chapters will look more deeply into fuzzy sets and fuzzy numbers.) &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;strong&gt;1.1 Fuzzy Logic.&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In conventional logic, a statement is either true or false, with nothing in between. This principle of true or false was formulated by Aristotle some 2000 years ago as the Law of the Excluded Middle, and has dominated Western logic ever since. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Fuzzy logic offers a better way of representing reality. In fuzzy logic, a statement is true to various degrees, ranging from completely true through half-truth to completely false. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;The basic idea of multi-valued logic has been explored to some extent by a number of mathematicians in this century, but the real breakthrough was made by Prof. Lotfi Zadeh of the University of California in Berkeley. In 1965 he published a paper on the theory of fuzzy sets; that paper has given rise to hundreds of papers on fuzzy mathematics and fuzzy systems theory. Most importantly, fuzzy theory was adopted wholeheartedly by the Japanese, and their advances in the field of fuzzy control have won the attention of engineers throughout the world. Fuzzy theory gives us a whole new approach to the mathematics of thinking; it is a &lt;em&gt;change of paradigm&lt;/em&gt; for Western world scientists and mathematicians, and like all changes of paradigm has been initially strenuously resisted, except in the Far East, where two-valued Aristotelian logic has not been too deeply ingrained. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;The computer tool which your knowledge engineer will be using for expert system development is FLOPS (&lt;span style='text-decoration:underline'&gt;&lt;strong&gt;F&lt;/strong&gt;&lt;/span&gt;uzzy &lt;span style='text-decoration:underline'&gt;&lt;strong&gt;LO&lt;/strong&gt;&lt;/span&gt;gic &lt;span style='text-decoration:underline'&gt;&lt;strong&gt;P&lt;/strong&gt;&lt;/span&gt;roduction &lt;span style='text-decoration:underline'&gt;&lt;strong&gt;S&lt;/strong&gt;&lt;/span&gt;ystem), developed originally in the early 1980's at the Kemp-Carraway Heart Institute by Douglas Tucker and William Siler for medical image analysis.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt; FLOPS is based on fuzzy systems theory: fuzzy logic; fuzzy sets; and fuzzy numbers. The use of fuzzy mathematics gives FLOPS some important advantages. It is possible to reason in terms of words, such as small, medium, fast, slow and so on, rather than in terms of numbers; ambiguities and contradictions can be easily handled; and uncertainties pose no problems. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In this chapter we will consider fuzzy logic, with a continuous gradation of truth values ranging from false to true. We define the truth of a statement or value as being the confidence we have that the statement or value is correct. Truth is measured numerically; in most fuzzy systems literature, as ranging from zero (false) to one (true). FLOPS uses a different scale; confidences in FLOPS range from 0 (false) to 1000 (true), since this scale economizes computer memory requirements. This difference in scale is sufficiently obvious.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt; I have defined what truth is for a single statement. But now consider the truth of the combination of two statements, A AND B. A and B are both assertions; for example, Ashok is a man, or I don't have much free time this week. In conventional logic, of course both A and B must be either true or false. The statement (A AND B) is true only if both A and B are individually true; otherwise, the statement (A AND B) is false. Now, how do we define the fuzzy truth value of the statement (A AND B) if the fuzzy truth values of A and B separately are known? Fuzzy logic gives a remarkably simple answer to this problem: the truth of (A AND B) together is the minimum of the truth value of A and the truth value of B. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Similarly, consider the statement (A OR B), which in conventional logic is true if statement A or statement B or both are true, and is only false if both A and B are false. In fuzzy logic, the truth of (A OR B) is simply the maximum of the truth value of A and the truth value of B. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;It is hard to see the practical importance of these simple rules of logic by themselves. However, most Western reasoning has its foundation in logic; &lt;em&gt;these simple but new rules of logic have great impact on patterns of reasoning&lt;/em&gt;. And it is with patterns of reasoning that we are most concerned in constructing expert systems; it is patterns of real-life productive human reasoning that we are trying to emulate. Fuzzy logic gives us the theoretical tools to do this. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;strong&gt; Fuzzy Sets&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In mathematics, the concept of &lt;em&gt;set&lt;/em&gt; is very simple, but very important. A set is simply a collection of things. The things can be most anything you want - numbers, names of autos, you name it. Things either belong to the set or don't belong, similar to the idea in logic that statements are either true or false. In 1965, Lotfi Zadeh proposed the idea of a &lt;em&gt;fuzzy set&lt;/em&gt;; a fuzzy set is one to which objects can belong to different degrees, called &lt;em&gt;grades of membership. in&lt;/em&gt; FLOPS, we measure the confidence that the member belongs to the fuzzy set as a number ranging from zero (absolutely false) to 1000 (absolutely true). One of my favorite fuzzy sets comes from the TV show MASH: &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:213px'/&gt;&lt;col style='width:213px'/&gt;&lt;col style='width:213px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Character&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt' colspan='2'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Fuzzy Sets:&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Men&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Athletes&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Hawkeye&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;1000&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;500&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;BeeGee&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;1000&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;750&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Lt.Col. Penobscot&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;1000&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;1000&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Hot Lips Hooli han&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;0&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;950&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Klinger&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;900&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;250&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;This simple idea of different grades of membership in a fuzzy set is extremely helpful in constructing expert systems. We will be concerned with fuzzy sets of descriptive words, where the grade of membership represents our confidence that the descriptor is true of whatever we are considering. Usually, we will use the term &lt;em&gt;confidence&lt;/em&gt; rather than grade of membership. This permits us to use ordinary language in describing things in a precise way. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;As an example, consider a fuzzy set &lt;strong&gt;speed&lt;/strong&gt;, with members &lt;strong&gt;Slow&lt;/strong&gt;,&lt;strong&gt; Medium&lt;/strong&gt; and &lt;strong&gt;Fast&lt;/strong&gt;. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;span style='font-size:12pt'&gt;&lt;br /&gt;						&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:160px'/&gt;&lt;col style='width:160px'/&gt;&lt;col style='width:160px'/&gt;&lt;col style='width:160px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Of course, we have to define in some way how to go back and forth between the description of speed in numbers and the description of speed in words. This is done through defining &lt;em&gt;membership functions&lt;/em&gt;, which look something like this: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;						&lt;/p&gt;&lt;p&gt;Of course, different experts would have different feelings about what speeds should be classified as Fast, Medium or Slow. Leaving a good deal of overlap on the adjacent membership functions is a very good idea; it lends robustness to the reasoning system. Membership functions need not be made up of straight lines; curvilinear shapes are available. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Other useful fuzzy sets are not descriptions of numbers, but of (in a broad sense) categories. These fuzzy sets are not word descriptors of "how much", but are answers to "what is it?" For example, fuzzy set &lt;strong&gt;color&lt;/strong&gt; might have members &lt;strong&gt;Red&lt;/strong&gt;,&lt;strong&gt; Green&lt;/strong&gt; and &lt;strong&gt;Blue&lt;/strong&gt;. Fuzzy set &lt;strong&gt;car&lt;/strong&gt; might have members &lt;strong&gt;Ford, Chevrolet&lt;/strong&gt;, &lt;strong&gt;Toyota &lt;/strong&gt;and &lt;strong&gt;Buick&lt;/strong&gt;. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;In fuzzy sets like speed and color it is very likely that two or more descriptors might have non-zero confidences at the same time; that is fine, since we are seldom certain that one descriptor is entirely right and the others are entirely wrong. These are ambiguities, and as mentioned above they lend strength to the reasoning process. But in other fuzzy sets like car, it is not possible for a car to be both a Buick and a Chevrolet. In this case, if more than one member has a non-zero confidence, we have a contradiction. Contradictions need to be resolved before leaving our program, often by examining more data. &lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;span style='font-size:18pt'&gt;&lt;strong&gt;1.3 Fuzzy Numbers.&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;The final major member of our fuzzy systems arsenal is the &lt;em&gt;fuzzy number&lt;/em&gt;. A fuzzy number is simply an ordinary number whose precise value is somewhat uncertain. Here, for example, is a fuzzy two. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;&lt;br /&gt;						&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;Here our confidence that numbers 1.5 or less belong to the fuzzy 2 is zero, as is our confidence that numbers 2.5 or greater belong to the fuzzy 2. Our confidence that 1.6 belongs to the fuzzy 2 is 200; for 1.7, 400; and so on to confidence 1000 for 2. For numbers greater than 2, the confidence declines as the number increases, being 800 for 2.1, 600 for 2.2, and so on to zero confidence for 2.5. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;A very convenient way to describe fuzzy numbers is to use modifying words. For example, the fuzzy two shown in Figure 1 could be completely specified by "roughly 2". Other modifying words available are "nearly", "about" and "crudely", with progressively larger uncertainties. These words are called &lt;em&gt;hedges&lt;/em&gt; in fuzzy math circles. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;With fuzzy numbers, we can make approximate comparisons. It is quite possible, for example, to ask if an input person's age is approximately equal to about 30. This is often very useful when our data or imprecise, or when we don't want the rigidity of accepting a person 30 years old but rejecting one thirty years plus one day old. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;A very convenient way to describe fuzzy numbers is to use modifying words. For example, the fuzzy two shown in Figure 2 could be completely specified by "roughly 2". Other modifying words available are "nearly", "about" and crudely, with progressively larger uncertainties. These words are called &lt;em&gt;hedges &lt;/em&gt;in fuzzy math circles. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:12pt'&gt;With fuzzy numbers, we can make approximate comparisons. It is quite possible, for example, to ask if an input person's age is approximately equal to about 30. This is often very useful when our data or imprecise, or when we don't want the rigidity of accepting a person 30 years old but rejecting one thirty years plus one day old. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-8819749255128593410?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/8819749255128593410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=8819749255128593410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8819749255128593410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8819749255128593410'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/05/fuzzy-mathematics-fuzzy-logic-fuzzy.html' title='Fuzzy Mathematics: Fuzzy Logic, Fuzzy Sets, Fuzzy Numbers.'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-8780095296501385109</id><published>2008-04-15T17:25:00.001+05:30</published><updated>2008-04-15T17:25:52.403+05:30</updated><title type='text'>Sample </title><content type='html'>This is the Sample Blog updated by me from GDATA API &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-8780095296501385109?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/8780095296501385109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=8780095296501385109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8780095296501385109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8780095296501385109'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/04/sample.html' title='Sample '/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-6155506698132152609</id><published>2008-04-07T11:48:00.001+05:30</published><updated>2008-04-07T11:48:34.666+05:30</updated><title type='text'>How to use SQL statements with LINQ</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Here is the answer. You can use it like this.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;String strSQL="select * from player_Master where player_Id={0}";&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: white'&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:#2b91af'&gt;IEnumerable&lt;/span&gt;&lt;span style='color:navy'&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#2b91af'&gt;Player_Master&lt;/span&gt;&lt;span style='color:navy'&gt;&amp;gt; PlayerList =  context11.ExecuteQuery&amp;lt;&lt;/span&gt;&lt;span style='color:#2b91af'&gt;Player_Master&lt;/span&gt;&lt;span style='color:navy'&gt;&amp;gt;(strSQL, &lt;/span&gt;&lt;span style='color:teal'&gt;"10023"&lt;/span&gt;&lt;span style='color:navy'&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: white'&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:#2b91af'&gt;Player_Master&lt;/span&gt;&lt;span style='color:navy'&gt; Paly11 = PlayertList.Single&amp;lt;&lt;/span&gt;&lt;span style='color:#2b91af'&gt;Player_Master&lt;/span&gt;&lt;span style='color:navy'&gt;&amp;gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: white'&gt;&lt;span style='color:navy; font-family:Courier New; font-size:10pt'&gt;Response.Write(Play11.PlayerName);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: white'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: white'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: white'&gt;&lt;span style='color:navy; font-family:Courier New; font-size:10pt'&gt;This is just a simpel &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-6155506698132152609?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/6155506698132152609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=6155506698132152609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6155506698132152609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6155506698132152609'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/04/how-to-use-sql-statements-with-linq.html' title='How to use SQL statements with LINQ'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-4288901725844216197</id><published>2008-03-29T17:22:00.001+05:30</published><updated>2008-03-29T17:22:27.969+05:30</updated><title type='text'>Difference Between .NET Remoting and Web Services</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;1. Web services can only be accessed over HTTP whereas .NET Remoting can be accessed over various protocols like TCP, HTTP etc.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;2. Web services operate in a stateless environment since its HTTP, a stateless protocol whereas .NET remoting support state management (as in through Singleton and SingleCall objects)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;3. Web services are more reliable than .NET Remoting.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;4. Web services are easy to create and use while .NET Remoting are complex  to be created.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;5. Web services support heterogeneous environments i.e. support interoperability across platforms, on the other hand .NET remoting requires client to be built using .NET, thus it does'nt support heterogeneous environment.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;6. Web Services support datatypes defined in the XSD type system while .NET remoting provides support for rich type system using binary communication.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;This question was asked me in an interview.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-4288901725844216197?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/4288901725844216197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=4288901725844216197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4288901725844216197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4288901725844216197'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/difference-between-net-remoting-and-web.html' title='Difference Between .NET Remoting and Web Services'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-6814287444689665528</id><published>2008-03-29T16:04:00.003+05:30</published><updated>2008-03-29T16:12:24.192+05:30</updated><title type='text'>.Net Remoting a simple example</title><content type='html'>&lt;div&gt;&lt;span xmlns=""&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;What Is .NET Remoting?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As you may already know that application domains and processes are two mechanisms for isolation between applications. Processes are the main insulator between two different applications. Application domains is another extra isolation layer between different applications, but its main purpose is to isolate parts of code inside the same application. These parts will have the same isolation and restrictions as if they are different applications.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Now, what if for one reason or another we need to use a part of code located at different application domain running within the same application, located in different process running on the same machine, or located inside another process running on a different machine?. For uses like this, .Net remoting does exists.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Microsoft .Net Remoting is created to solve these problems. It provides a solution for communication between application domains and processes in a seamlessly and transparent way. This is due to the power of .Net remoting programming model and run time support.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;When Microsoft developers designed .Net remoting framework, they have taken into consideration flexibility and customizability. This is done by separating the remotable object - in other words the object that you need to call remotely (located at another application domain or process) - from the client or server application domain and from any specific mechanism of communication. You can replace one communication protocol with a different one without the need to recompile the client or the server. Another flexibility related feature is that .Net remoting is a language independent framework, you can choose any application mode to communicate from. You can communicate using a web application, a console application, or a Windows Service. Any application can host a remoting object and provides its services to any client whether or not it is located within the same process boundaries, or in separate processes located on one machine or a set if disparate machines.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;It is worth mentioning that objects in different application domains communicate using one of two techniques or methods. The first one is by transporting copies of objects across application domain boundaries. The second one is by using a proxy to exchange messages between them. .Net remoting framework uses the second technique.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;.Net Remoting components&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;To allow an application located in different application domain or process to communicate with another one using .Net remoting technique, you have to just build the following:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;A remotable object. Which is an object that contain some properties and methods located in one application domain and you need to call its methods or properties from another application domain or process.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;A host application. This is the host of the remotable object. It is also called the server application. The main task of this host is to listen to requests for the hosted remotable object.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;A client application. This is the application which makes requests for the remotable object.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;Types of Remotable Objects&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;There are 3 types of remotable objects that you can configure and choose from depending on the requirements of your application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Single Call: The remotable object is intended to be called from one client / one instance at a time.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Singleton Call: Several clients / several instances of the remotable object can be utilized&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Activation: Richer than &lt;em&gt;Singleton &lt;/em&gt;in the regard of other aspects.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;How Does .NET Remoting Works?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As we mentioned previously you need to build a remotable type or object, a host or server application, and a client application to be able to communicate. In the client application you need only to create a new instance of the remotable object by using "New" or the instance creation function. When you do this the remoting system creates a proxy object that looks like the remote type to the client. When the client calls a method of the remotable type it actually call the method on the created proxy. The remoting system receives that call and routes it to the server process, it then processes the request, and returns the result to the client proxy, which in turn returns it to the client application. The client application will get the feeling of the remotable object as it is running inside the same process not inside another one. The proxy object is the system component that creates the impression that the server object is in the client's process not in a separate process or computer.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;To get the above scenario to work perfectly, you actually need to know about two things: the first is &lt;em&gt;channels, &lt;/em&gt;and the second is &lt;em&gt;configuration&lt;/em&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;Channels&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;If you try to build the remoting system yourself, you will need to learn network programming and a wide array of protocols and serialization formats. For purposes like that .NET remoting provides the concept of &lt;em&gt;transport channel &lt;/em&gt;that represents the combination of the underlying technologies required to open a network connection and to use a particular protocol to send the bytes to the receiving application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Channels are the transport media used to send / receive messages between applications across remoting boundaries (these boundaries can be between application domains, processes, or computers). A channel is an object that takes a stream of data, packages it according to a specific network protocol, and then sends the package to the other side. Channels can be categorized as channels which can send messages, channels which can receive messages, or channels which can perform both sending and receiving like the two .NET channels "HTTPChannel" and "TCPChannel".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;By using the channel concept or technique you can plug in a wide range of protocols even if the common language runtime is not at the other end of the channel. You can also create your own channel object using whatever network protocol you prefer if it is not supported by the .NET framework.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;You have to register at least one channel to use with the remoting infrastructure before being able to call the remotable type from the client application. You can register a channel in one of two ways: by calling "ChannelServices.RegisterChannel ", or by using a configuration file. You have to choose a specific port for your channel to listen on. If you are not sure whether a port is available or not, use 0 (zero) when you configuring your channel's port and the remoting system will choose an available port for you.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;Configuration&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The .NET remoting infrastructure needs specific information to work successfully and smoothly. That information is what we call configurations. You can choose one of the available two ways to configure your remotable types depending on your own preferences. The first way is by calling configuration methods directly from your server and client code, and this is what we call programmatic configuration. The second way is by creating an XML configuration file (.config file). To configure your remotable type properly whether by programmatic configuration or through a configuration file you have to provide the following information:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The activation type of your remotable object.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The name or address of the metadata that describes the remotable type.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The kind of the registered channel and the port number.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The URL that uniquely identifies the remotable type.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;You should now recall that a .Net remoting application consists of three components. These are the remotable type, the host or server, and the client. In this part of our tutorial we will build a .NET remoting application using a technique nearly suitable for any scenario you may need to use .NET remoting with.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;Building a .Net Remoting Application&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;.NET remoting has a very straightforward technique. If you want to build an application that uses .Net remoting to communicate across application domain boundaries all what you have to do is to implement the three components mentioned above. You also need to configure the remoting system to use remote activation for the remotable type. This requirements applies whatever the complexity of your remoting scenario.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;&lt;strong&gt;Building a Remotable Type&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The remotable object is a very typical / standard object, the difference is just it is being called from outside its application domain. To give any object the ability to be called from outside its application domain boundaries, the class that declare that object must inherit from "MarshalByRefObject" class. The "MarshalByRefObject" class is the base class for objects being communicated across application domains boundaries by exchanging messages using a proxy. So, when our class inherits this class, it automatically gets the same ability of communication as the "MarshalByRefObject" class. Also, the remotable class must be compiled into a .DLL library to be able to call its services. The following lines of code shows you an example of how to code a remotable type. First, open up your MS Visual Studio .NET, create new project, then add a new class to the created project. As shown in our example below the class name is "TheRemotableObject".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Public Class TheRemotableObject&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Inherits MarshalByRefObject&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Private List As String() = {"String1", "String2", "String3"}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Public Function ViewItem(ByVal ItemNum As Integer) As String&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;If ItemNum &amp;gt; List.GetUpperBound(0) _&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Or ItemNum &amp;lt; List.GetLowerBound(0) Then Return "Error"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Return List(ItemNum)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Function&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Class&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The class shown in the above piece of code is a remotable class because it inherits the "MarshalByRefObject". It has a private list of strings and one public method or service. The method's mission is to take an integer list index as an input parameter, checks that the input is within the list boundaries and if so returns the specified or selected string to the caller.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Save the file containing the above created class - in our case it will be saved as "TheRemotableObject.vb". To compile this class into a library, use your command line tools shipped with the .NET framework SDK as shown in the following command line.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Note that: you should first run the [ Start / Programs / Microsoft Visual Studio 2005 / Visual Studio Tools / Visual Studio 2005 Command Prompt ] to be able to use the "vbc" compiler. You also have to run the following command from inside the directory inside which you saved the class file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;gt; vbc /t:library TheRemotableObject.vb&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As a result of running the above command a new file "TheRemotableObject.dll" is now created at the same location as the "TheRemotableObject.vb" file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;&lt;strong&gt;Building a Host Application&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Building such a remotable object as shown in the pervious section is not enough to make the required communication across application domains boundaries. Indeed, you need to build another kind of application to perform the communication process. You can think of building such a remotable type or object as just remarking this object as "could be shared or called remotely" but no more. You stilll need some kind of application being able of receiving calls to this newly created remotable object, identifying these calls, creating an instance from the called object, running the required service or method, and finally returning results to the caller. This is the host / server / listener application. A host application does its job by the mean of using channels. Channels are objects responsible of handling the network protocols and serialization formats on your behalf. In addition, the host application registers your remotable type with the .NET remoting system so that it can use your channel to listen for requests for your object. Host applications can be of any type. It can be a Windows forms application, an ASP.NET application, a Windows service application, a console application, or any type of a managed application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Now, to an example:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Close all open projects or solutions, and create a new console application in a new directory (in our example we will name it example2). As a console application you will find module that is created by default (Module). Rename "Module1" as "Listener". Double click the "Listener" icon and change the module name shown in the code window. Add the imports statement and the lines of code inside the "Main" sub as shown in the following code snippet:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Imports System.Runtime.Remoting&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Module Listener&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Sub Main()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;RemotingConfiguration.Configure("Listener.exe.config")&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;System.Console.WriteLine("Listener: Press &amp;lt;Enter&amp;gt; to exit ...")&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;System.Console.ReadLine()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Module&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;In the above code we firstly configure the remoting infrastructure by using a configuration file named "Listener.exe.config". Then we send a message to the user, and waiting till the user hits the &amp;lt;enter&amp;gt; key to exit. The last line main and only purpose is to keep the application running till the &amp;lt;enter&amp;gt; key is pressed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The configuration file is an XML file specifying some configurations like the name and the URI of the remotable type, the kind of the used channel (whether it is an http or tcp channel), the port number to listen on, and the server activation mode. The remoting system uses the information in this file to listen for remote requests and route them to an instance of the remotable object or type. Below is a copy of the listener configuration file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;system.runtime.remoting&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;application&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;service&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;wellknown&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;mode="Singleton"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;type="TheRemotableObject, RemotableType"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;objectUri="TheRemotableObject.rem"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;/&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/service&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;channels&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;channel ref="http" port="8989"/&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/channels&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/application&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/system.runtime.remoting&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;To compile the above "Listener.vb" module we will use the command line tools like in compiling the remotable object class above. Before compilation you have to save a copy of the "The remotableObject.dll" created in the previous example in the same directory with the "Listener.vb". Then save the above configuration file under the name specified in the listener module code file (which is "Listener.exe.config") in the same directory as the "Listener.vb" file. Position your command line prompt at the directory that contains the three files mentioned above then run the following command line.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;gt; vbc /r:TheRemotableObject.dll Listener.vb&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As a result you will get "Listener.exe" file in the same directory with the "Listener.vb".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;&lt;strong&gt;Building a Client Application&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;To build a client application that utilizes the remotable type "TheRemotableObject" and hosted by the "Listener" application created above, you have to register this client application as a client for the specified remotable type. When you do this, the client application will call the remotable type as if it does exist in the same application domain with the client. The following code example shows you how to build a client application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Close all open projects and solution in your Visual Studio .NET 2005 then create a new console application giving it a name and a directory to be created in (in our example the project name will be "Example3"). Rename the default created module "Module1" to "Client" then double click its icon to open the code file. Rename the module to "Client". Add the imports statement and the lines of code inside the "Main" sub as shown in the following code snippet.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Imports System.Runtime.Remoting&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Module Client&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Sub Main()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;RemotingConfiguration.Configure("Client.exe.config")&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Dim RM As New TheRemotableObject()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;System.Console.WriteLine("Result = " + RM.ViewItem(1))&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;End Module&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As shown in the code above you have to configure the remoting infrastructure with the "Client.exe.config" XML configuration file. Then you define and create a new instance of the remotable type "TheRemotableObject". Call the remotable method "ViewItem" then write the result to the console. Although the "TheRemotableObject" type is not in the same application domain with the "Client" but you will be able to call its services "ViewItem" remotly and will be able to receive the results. Of course the last two lines of code in the "Main" subroutine will be marked as error but this is not a matter, just ignore it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Write the following configuration file and save it under the name "Client.exe.config" at the same directory of the "Client.vb" code file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;system.runtime.remoting&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;application&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;client&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;wellknown&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;type="TheRemotableObject, RemotableType"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;Url="http://localhost:8989/TheRemotableObject.rem"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;/&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/client&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/application&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/system.runtime.remoting&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;The configuration file tells the remoting system that the type information of the remotable type can be found in the "TheRemotableType" assembly. This remotable object located at "&lt;a href="http://localhost:8989/TheRemotableObject.rem"&gt;&lt;span style="TEXT-DECORATION: underline;color:blue;" &gt;http://localhost:8989/TheRemotableObject.rem&lt;/span&gt;&lt;/a&gt;". If you want to run this application over a network, you have to write the remote computer name instead of "localhost" in the url above. You must pay attention when you write a configuration file. Although it is simple but most errors comes from incorrect settings or mismatching between settings in the two configuration files used by client and host applications.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Now put a copy of the "TheRemotableObject.dll" created in example1 and compile the above "Client.vb" using command line tools as follows.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&amp;gt; vbc /r:TheRemotableObject.dll Client.vb&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;As a result you will get "Client.exe" file at the same directory with the "Client.vb".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Arial;color:#3366ff;"&gt;&lt;strong&gt;Running The Complete .NET Remoting application&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Now The situation is : We have one directory called "Example2" (which is the listener directory) that contains "Listener.exe", "Listener.exe.config", and "TheRemotableObject.dll" files. We have another directory called "Example3" (which is the client directory) that contains "Client.exe", "Client.exe.config", and "TheRemotableObject.dll" files. Note: "Example2", and "Example3" are depicted as "L" and "cl" in the figure below.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="TEXT-ALIGN: center"&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_THYCmHfK3IY/R-4c4VI7pkI/AAAAAAAAACk/ly5-16z3xnY/s1600-h/Screen.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_THYCmHfK3IY/R-4c4VI7pkI/AAAAAAAAACk/ly5-16z3xnY/s320/Screen.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5183111975222879810" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;Figure 1 - The host listing to the client and fulfill its requests&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:9;"&gt;To run and test the remoting process between these two different applications where each one of them has its own application domain and process boundaries do the following: Run the command line prompt at the listener directory and type: Listener, then press &amp;lt;enter&amp;gt;. A message will be displayed as shown in figure1 in the above window. Now open a new command prompt in the client directory and type: Client, then press &amp;lt;enter&amp;gt;. When you do so the client application will call the remotable type, while the server at the other side of the channel listening for any requests. It receives the client request, process it then returns the results back to the client. The client gets the result and displays it to you at the client command prompt as shown in figure1 in the second window.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-6814287444689665528?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/6814287444689665528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=6814287444689665528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6814287444689665528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6814287444689665528'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/net-remoting-simple-example.html' title='.Net Remoting a simple example'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_THYCmHfK3IY/R-4c4VI7pkI/AAAAAAAAACk/ly5-16z3xnY/s72-c/Screen.JPG' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-5858849948453617946</id><published>2008-03-24T18:37:00.001+05:30</published><updated>2008-03-24T18:37:17.872+05:30</updated><title type='text'>Some Useful links</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;span style='color:black; font-size:13pt'&gt;&lt;strong&gt;Links Related to INDIA&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/rules.html'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Some Good Views About Life&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:#ad1463'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/Posters.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Some Good Posters&lt;/span&gt;&lt;span style='color:#ad1463'&gt;&lt;br/&gt;&lt;a href='http://www.india-today.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;India Today&lt;/span&gt;&lt;span style='color:#ad1463'&gt;&lt;br/&gt;&lt;a href='http://www.indiaworld.co.in'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;India World&lt;/span&gt;&lt;span style='color:#ad1463'&gt;&lt;br/&gt;&lt;a href='http://www.indolink.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Indolink&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.timesofindia.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;The Times of India&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;						&lt;br/&gt;&lt;a href='http://www.gujaratsamachar.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Gujarat Samachar &lt;a href='http://www.sandesh.com'&gt;: Sandesh&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://weather.yahoo.com/regional/India.html'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Weather - India&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/garba.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Listern to GARBA Audio &lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.indianconsulate-sf.org/indlink.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Links related to India&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.indianconsulate-sf.org'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Consulate General of India &lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;span style='color:black; font-size:13pt'&gt;&lt;strong&gt;Other Useful Links&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.cnn.com'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;CNN News &lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.news.bbc.co.uk'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;BBC News &lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.pathfinder.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Good Magazines, TIME, People,...&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/search.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Good Search Engines&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/astronomy.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Links to Astronomy&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.ins.usdoj.gov/'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;INS Home Page&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://travel.state.gov/'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;VISA Informations&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.nps.gov/'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;National Park Service&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://gocalif.ca.gov/'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;California Travel &amp;amp; Tourism&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/area.html'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Bay Area Favorites&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/sv.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Silicon Valley Gateway&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.vjf.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Virtual Job Search&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.careerpath.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;The Right Place for Job Hunting&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.careermosaic.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Career Mosaic&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/aid.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;General Aid&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.isdmag.com'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Integrated System Design&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.chipanalyst.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Microprocessor Design Resource&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://techweb.cmp.com/eet/823'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;EE Times&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://teche.cacs.usl.edu/tutorial/unix-vi/tableofcontents3_2.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;UNIX Reference Desk&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.linuxbox.com/%7Etaylor/4ltrwrd'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Another UNIX Reference Desk&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.microtimes.com'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Mirco Times&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://wfn-shop.princeton.edu/foldoc/contents.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Dictonary of Computing Contents&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.lib.utexas.edu/Libs/PCL/Reference.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Library Online/Quick Reference&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.sdsu.edu/%7Eboyns/java/mcii/mcii.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Missile Cammando - Game&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.nasa.gov'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;NASA Web Page&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://shuttle-mir.nasa.gov'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Shuttle/MIR Web Page&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://nssdc.gsfc.nasa.gov/photo_gallery/photogallery.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;NSSDC Photo Gallery&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://oposite.stsci.edu/pubinfo/BestOfHST95.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;HST Picture Gallery&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://bigbear.caltech.edu/welcome_old.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Big Bear Solar Observatory&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.seds.org'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;SEDS:Good Astro Search Engine&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br/&gt;&lt;a href='http://www.hq.nasa.gov/alsj/frame.html'/&gt;&lt;/span&gt;&lt;span style='color:blue; text-decoration:underline'&gt;Apollo Lunar Surface Journal&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.donotbuygetfree.com'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Guide to fun &amp;amp; freeware&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.lliiffee.com'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Live DOUBLE LIFE in one!&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://blog.inc.com/archives/2005/02/25/top_10_business_movies.html'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:12pt; text-decoration:underline'&gt;Top 10 Business Movies&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;  according to Inc.com. Interestingly, most of them show businessmen as greedy bad guys.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.geocities.com/CollegePark/Campus/3724/truth.html'&gt;Some GOOD Thoughts &lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-5858849948453617946?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/5858849948453617946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=5858849948453617946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/5858849948453617946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/5858849948453617946'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/some-useful-links.html' title='Some Useful links'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-9158332321728016346</id><published>2008-03-20T19:36:00.001+05:30</published><updated>2008-03-20T19:36:47.890+05:30</updated><title type='text'>Using Application Configuration file</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;This article covers using application configuration files in Microsoft .NET. It briefly outlines the concept of application configuration files In particular, it discusses using the System.Configuration namespace&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;Application Configuration Background&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;&lt;a name='more'/&gt;Building configurable applications is not a new concept. The idea of applications relying on configuration parameters to dictate behavior at run time has been around for many years. For those of us who were around Microsoft-based programming prior to .NET, the most common example is the use of INI files. INI files are simple text-based files with key and value pairs; the key is used to fetch the value, and the value is then used in some way to influence the application settings and/or resulting behavior. This way, you can modify the configuration file to drive program behavior without having to recompile the application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;INI files generally worked great, except for the following drawbacks:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Everyone wrote their own parsers for dealing with them. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;You had to have them on the machine where the application was running. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;They required disk operations to read their files. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Microsoft moved away from INI files and towards storing everything in the Registry, which made application deployment much more difficult. As a result, Microsoft moved back to the concept of an "xcopy deployment," by which programmers deployed applications by simply copying files. Redmond used XML and some objects built into the Microsoft .NET Framework to bring new life to our old friend the application configuration file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;System.Configuration Basics&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The System.Configuration namespace provides the functionality for reading configuration files. Microsoft released an XML schema dictating the format for configuration files that can be read using the System.Configuration API, enabling the accessing object to automatically consume the configuration files. This way, you can allow configuration files to be read without having to develop &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The name and storage location of an application configuration file depends on the application type with which it is being used. A configuration file for an executable (.exe) is located in the same directory as the application. The file is the name of the application with a .config extension. For example, notepad.exe would have a configuration file of notepad.exe.config. A configuration file for an ASP.NET application is called web.config and is located in the root of the application's virtual directory.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;appSettings Section&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;An application configuration file follows a specific XML schema. The appSettings section is a predefined section of the configuration file designed to make it very easy to retrieve a value based on a given name. This is the easiest way to add application-specific settings into an application configuration file. The appSettings section of the configuration file consists of a series of "add" elements with "key" and "value" attributes. While the appSettings section is predefined, it is not included in a configuration file by default and must be manually added. A simple example of a configuration file would be the following:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;?&lt;/span&gt;&lt;span style='color:black'&gt;xml &lt;/span&gt;&lt;span style='color:red'&gt;version&lt;/span&gt;&lt;span style='color:blue'&gt;="1.0"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;encoding&lt;/span&gt;&lt;span style='color:blue'&gt;="utf-8" ?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ApplicationTitle"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ConnectionString"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Server=localhost;Database=Northwind;Integrated&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                  Security=false;User Id=sa;Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The AppSettings property of the ConfigurationSettings object in the System.Configuration namespace is used to get the settings. For example, to read either of the settings above, the following sample code would do the trick:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:green'&gt;// Read appSettings&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; title = ConfigurationSettings.AppSettings["ApplicationTitle"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; connectString =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:black; font-family:Courier New; font-size:9pt'&gt;       ConfigurationSettings.AppSettings["ConnectionString"];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Now, you could easily set a dynamic title value or read database connection string information from the application configuration file. This gives you the freedom to adjust settings without having to recompile any code.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;Customized Configuration Sections&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;If you have distinct groupings of configurations to be included in the application configuration file, consider creating a custom configuration section in lieu of the appSettings section. This will allow you more organizational structuring around the storage of various settings. You include a custom section by including the configSections element in the configuration file and a sub-element called section that defines the custom section and the handler for reading it. The .NET Framework contains an IConfigurationSectionHandler interface that dictates the required functionality handlers provide by allowing you to use custom handlers with the Configuration if you so choose. This example just uses handlers the .NET Framework already provides. Continuing the example from the previous section, the following configuration file contains a custom section and specifies which handler to use for reading:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;?&lt;/span&gt;&lt;span style='color:black'&gt;xml &lt;/span&gt;&lt;span style='color:red'&gt;version&lt;/span&gt;&lt;span style='color:blue'&gt;="1.0"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;encoding&lt;/span&gt;&lt;span style='color:blue'&gt;="utf-8" ?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;configSections&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;section &lt;/span&gt;&lt;span style='color:red'&gt;name&lt;/span&gt;&lt;span style='color:blue'&gt;="sampleSection"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;               type&lt;/span&gt;&lt;span style='color:blue'&gt;="System.Configuration.SingleTagSectionHandler" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;configSections&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;   &amp;lt;sampleSection &lt;/span&gt;&lt;span style='color:red'&gt;ApplicationTitle&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;ConnectionString&lt;/span&gt;&lt;span style='color:blue'&gt;="Server=localhost;Database=Northwind;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                      Integrated Security=false;User Id=sa;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                      Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ApplicationTitle"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ConnectionString"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Server=localhost;Database=Northwind;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                  Integrated Security=false;User Id=sa;Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The following code reads the configuration settings into a dictionary, where you can easily access the values:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:green'&gt;// Read customSection&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:black; font-family:Courier New; font-size:9pt'&gt;System.Collections.IDictionary sampleTable = (IDictionary)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:black; font-family:Courier New; font-size:9pt'&gt;   ConfigurationSettings.GetConfig("sampleSection");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; title = (&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt;)sampleTable["ApplicationTitle"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; connectString = (&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt;)sampleTable["ConnectionString"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;Customized Configuration Sections and Groups&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The issue with custom configuration sections alone is that they rely on attributes to store all of the settings as a part of a single element. This can become cumbersome when a large number of configurations are contained within a section or additional related sections. You can further organize similar custom sections into a section group, which makes it easier to work with numerous configurations and helps eliminate naming conflicts with custom configuration sections. This is especially useful where your application contains reference to several other DLLs that read configuration information from the host applications configuration file. A sectionGroup element is simply placed around one or more section elements to create a group. Expanding the example configuration file, the following configuration file contains a custom group, section, and the pre-defined appSettings:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;?&lt;/span&gt;&lt;span style='color:black'&gt;xml &lt;/span&gt;&lt;span style='color:red'&gt;version&lt;/span&gt;&lt;span style='color:blue'&gt;="1.0"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;encoding&lt;/span&gt;&lt;span style='color:blue'&gt;="utf-8" ?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;configSections&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;section &lt;/span&gt;&lt;span style='color:red'&gt;name&lt;/span&gt;&lt;span style='color:blue'&gt;="sampleSection"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;type&lt;/span&gt;&lt;span style='color:blue'&gt;="System.Configuration.SingleTagSectionHandler" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;sectionGroup &lt;/span&gt;&lt;span style='color:red'&gt;name&lt;/span&gt;&lt;span style='color:blue'&gt;="CodeGuru"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;         &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;section &lt;/span&gt;&lt;span style='color:red'&gt;name&lt;/span&gt;&lt;span style='color:blue'&gt;="utilitySection"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;type&lt;/span&gt;&lt;span style='color:blue'&gt;="System.Configuration.NameValueSectionHandler,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                        System,Version=1.0.5000.0, Culture=neutral,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                        PublicKeyToken=b77a5c561934e089" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;sectionGroup&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;configSections&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;sampleSection &lt;/span&gt;&lt;span style='color:red'&gt;ApplicationTitle&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;    ConnectionString="Server=localhost;Database=Northwind;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                      Integrated Security=false;User Id=sa;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                      Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;CodeGuru&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;utilitySection&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;         &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:black'&gt;="ApplicationTitle"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;         &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ConnectionString"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Server=localhost;Database=Northwind;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                     Integrated Security=false;User Id=sa;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                     Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;utilitySection&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;CodeGuru&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ApplicationTitle"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Sample Console Application" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:black'&gt;add &lt;/span&gt;&lt;span style='color:red'&gt;key&lt;/span&gt;&lt;span style='color:blue'&gt;="ConnectionString"&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:red'&gt;value&lt;/span&gt;&lt;span style='color:blue'&gt;="Server=localhost;Database=Northwind;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:blue; font-family:Courier New; font-size:9pt'&gt;                  Integrated Security=false;User Id=sa;Password=;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;   &amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;appSettings&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;&amp;lt;/&lt;/span&gt;&lt;span style='color:black'&gt;configuration&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Note the extra "Version," "Culture," and "PublicKeyToken" specified in defining a section group. These all come from what the machine.config configures on the local machine. Occasionally, it has worked for me without them, but other times an exception is thrown that it can't create the appropriate handler. I've found that if I include those items, it consistently works.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;The following code can access the items in the custom group by loading the group into a NameValueCollection for easy access to the key and value pairs:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:green'&gt;// Read custom sectionGroup&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:black; font-family:Courier New; font-size:9pt'&gt;NameValueCollection collection = (NameValueCollection)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='color:black; font-family:Courier New; font-size:9pt'&gt;ConfigurationSettings.GetConfig("CodeGuru/utilitySection");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; title = collection["ApplicationTitle"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #eeeeee'&gt;&lt;span style='font-family:Courier New; font-size:9pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; connectString = collection["ConnectionString"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Note the path-like statement required to find the appropriate section to read when accessing the custom section.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:13pt'&gt;&lt;strong&gt;Possible Enhancements&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;This article has touched on some of the basics of using application configuration files, including the ability to define your own sections and groups of sections. Here are a couple of additional items for you to ponder about application configuration settings:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Introduce some form of encryption to keep configuration settings safe. While the application configuration files are secured by operating system permissions, that won't always prevent prying eyes from seeing the information they contain. The use of plain text-based XML makes it insecure to store items such as connection string information that contain passwords within the configuration file. Building your own wrapper around the System.Configuration or creating a custom configuration section and implementing the IConfigurationSectionHandler interface in a custom handler allows you to build your own methods to include encryption to keep information secure in the application configuration file. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='color:black; font-family:Verdana; font-size:8pt'&gt;Use application configuration settings to dynamically assign field and/or property values. This won't work for standalone DLLs that don't have a configuration file, but it will work if your DLL is utilized by an executable or ASP.NET application, as is often the case with utility libraries or business logic components. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-9158332321728016346?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/9158332321728016346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=9158332321728016346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/9158332321728016346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/9158332321728016346'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/using-application-configuration-file.html' title='Using Application Configuration file'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-8870358343509364079</id><published>2008-03-14T16:51:00.001+05:30</published><updated>2008-03-14T16:51:56.628+05:30</updated><title type='text'>System Development Life Cycle</title><content type='html'>&lt;span xmlns=''&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:680px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt;&lt;p&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:9pt'&gt;&lt;strong&gt;SDLC&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;SDLC is the process of developing information systems through investigation, analysis, design, implementation and maintenance. SDLC is also known as information systems development or application development. It is also known as Waterfall Model&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;The software development life cycle (SDLC) is the entire process of formal, logical steps taken to develop a software product. The phases of SDLC can vary somewhat but generally include the following: &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Requirements Analysis&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Extracting the requirements of a desired software product is the first task in creating it. While customers probably believe they know what the software is to do, it may require skill and experience in software engineering to recognize incomplete, ambiguous or contradictory requirements. &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Specification&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Specification is the task of precisely describing the software to be written, in a mathematically rigorous way. In practice, most successful specifications are written to understand and fine-tune applications that were already well-developed, although safety-critical software systems are often carefully specified prior to application development. Specifications are most important for external interfaces that must remain stable. &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Software architecture&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;The architecture of a software system refers to an abstract representation of that system. Architecture is concerned with making sure the software system will meet the requirements of the product, as well as ensuring that future requirements can be addressed. The architecture step also addresses interfaces between the software system and other software products, as well as the underlying hardware or the host operating system. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Coding&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Reducing a design to code may be the most obvious part of the software engineering job, but it is not necessarily the largest portion. &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Testing&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Testing of parts of software, especially where code by two different engineers must work together, falls to the software engineer. &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Documentation&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;An important task is documenting the internal design of software for the purpose of future maintenance and enhancement. Documentation is most important for external interfaces. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Software Training and Support&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;A large percentage of software projects fail because the developers fail to realize that it doesn't matter how much time and planning a development team puts into creating software if nobody in an organization ends up using it. People are occasionally resistant to change and avoid venturing into an unfamiliar area, so as a part of the deployment phase, its very important to have training classes for the most enthusiastic software users (build excitement and confidence), shifting the training towards the neutral users intermixed with the avid supporters, and finally incorporate the rest of the organization into adopting the new software. Users will have lots of questions and software problems which leads to the next phase of Software.&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Maintenance&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Maintaining and enhancing software to cope with newly discovered problems or new requirements can take far more time than the initial development of the software. Not only may it be necessary to add code that does not fit the original design but just determining how software works at some point after it is completed may require significant effort by a software engineer. About 2/3 of all software engineering work is maintenance, but this statistic can be misleading. A small part of that is fixing bugs. &lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Process Models&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;There are several methodologies or models that can be used to guide the software development lifecycle. Some of these include: &lt;br/&gt;--Linear or Waterfall Model &lt;br/&gt;--Rapid Application Development (RAD)&lt;br/&gt;--Joint Application Development (JAD)&lt;br/&gt;--Prototyping Model&lt;br/&gt;--Fountain Model&lt;br/&gt;--Spiral Model&lt;br/&gt;--Build and Fix&lt;br/&gt;--Synchronize-and-Stabilize&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Rapid Application Development&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;"Rapid Application Development (RAD) is an incremental software development process model that emphasizes a very short development cycle typically 60-90 days". The RAD approach encompasses the following phases: &lt;br/&gt;1.Business Modeling&lt;br/&gt;2.Data Modeling&lt;br/&gt;3.Process Modeling&lt;br/&gt;4.Application Generation&lt;br/&gt;5.Testing and Turnover&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Business Modeling&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;The information flow among business functions is modeled in am way that answers the following questions:&lt;br/&gt;1.What information drives the business process?&lt;br/&gt;2.What information is generated?&lt;br/&gt;3.Who generates it?&lt;br/&gt;4.Where does the information go?&lt;br/&gt;5.Who processes it?&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Data Modelling&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;The information flow defined as part of the business modeling phase is refined into a set of data objects that are needed to support the business. The characteristic of each object is identified and the relationship between these objects are defined.&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Process Modelling&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;The data objects defined in the data-modeling phase are transformed to achieve the information flow necessary to implement a business function. Processing the descriptions are created for adding, modifying, deleting or retrieving data object.&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Application Generation&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;RAD assumes the use of the RAD tools like VB,VC++,Delphi etc rather than creating&lt;br/&gt;software using conventional third generation programming languages. The RAD works to reuse &lt;br/&gt;existing program components or create reusable components. In all cases, automated tools are used to facilitate construction of the software.&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Testing and Turnover&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;Since the RAD process emphasizes reuse, many of the program components have already been tested. This minimize the testing and development time.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-8870358343509364079?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/8870358343509364079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=8870358343509364079' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8870358343509364079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8870358343509364079'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/system-development-life-cycle.html' title='System Development Life Cycle'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-145686675833728614</id><published>2008-03-14T16:42:00.001+05:30</published><updated>2008-03-14T16:42:28.940+05:30</updated><title type='text'>Data Flow Diagrams Notations</title><content type='html'>&lt;span xmlns=''&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:680px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt;&lt;p&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:9pt'&gt;&lt;strong&gt;DFD&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#0099ff; font-family:Arial; font-size:8pt'&gt;&lt;strong&gt;&lt;em&gt;Data Flow Diagrams&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:black; font-family:Arial; font-size:7pt'&gt;A data flow diagram is a graphical technique that depicts information flow and the transforms that are applied as data move from input to output. The data flow diagram is also known as 'data flow graph'. Various symbols are used to depict the data from one level to another level.&lt;br/&gt;The data flow diagram must be used to represent the system or software at any level of abstraction. In fact data flow diagram may partitioned into the levels that represent increasing information flow for functional modeling as information on flow modeling. In doing so it satisfies the second operational analysis principle i.e., creating a functional model.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='font-family:Arial'&gt;&lt;span style='color:#0099ff; font-size:9pt'&gt;&lt;strong&gt;Notation&lt;/strong&gt;&lt;/span&gt;&lt;span style='color:black; font-size:7pt'&gt;&lt;br/&gt;Logical data flow diagrams can be completed using only four simple notations, i.e. special symbols or icons and the annotation that associates them with a specific system the Yourdon approach is used. &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;1.DataFlow&lt;span style='color:black; font-size:7pt'&gt;&lt;br/&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:black; font-family:Arial; font-size:7pt'&gt;Data move in a specific direction from an origin to a destination in the form of a document. The data flow is a "packet of data".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;2.Process&lt;br /&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:black; font-family:Arial; font-size:7pt'&gt;&lt;br/&gt;People procedure or devices that use or produce data. The physical component is not identified.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;3.Source or Destination&lt;span style='color:black; font-size:7pt'&gt;&lt;br/&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:black; font-family:Arial; font-size:7pt'&gt;External sources or destinations of data interact with the system but are outside its boundary.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;4.Data Store&lt;span style='color:black; font-size:7pt'&gt;&lt;br/&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: justify'&gt;&lt;span style='color:black; font-family:Arial; font-size:7pt'&gt;Here data are stored or referenced by process in the system.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-145686675833728614?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/145686675833728614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=145686675833728614' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/145686675833728614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/145686675833728614'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/data-flow-diagrams-notations.html' title='Data Flow Diagrams Notations'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-4444073695184850433</id><published>2008-03-14T16:13:00.001+05:30</published><updated>2008-03-14T16:13:03.505+05:30</updated><title type='text'>Structure of Software Requirements Specification Document</title><content type='html'>&lt;span xmlns=''&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:680px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt;&lt;p&gt;&lt;h1&gt;1. Introduction&lt;br /&gt;&lt;/h1&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1.1 Purpose of this document&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the purpose of the document, and the intended audience. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1.2 Scope of this document&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the scope of this requirements definition effort. Introduces the requirements elicitation team, including users, customers, system engineers, and developers. &lt;br/&gt;This section also details any constraints that were placed upon the requirements elicitation process, such as schedules, costs, or the software engineering environment used to develop requirements.&lt;/p&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td vAlign='middle'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1.3 Overview&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Provides a brief overview of the product defined as a result of the requirements elicitation process.&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1.4 Business Context&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Provides an overview of the business organization sponsoring the development of this product. This overview should include the business's mission statement and its organizational objectives or goals. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;2. General Description&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.1 Product Functions&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Describes the general functionality of the product, which will be discussed in more detail below. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.2 Similar System Information&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Describes the relationship of this product with any other products. Specifies if this product is intended to be stand-alone, or else used as a component of a larger product. If the latter, this section discusses the relationship of this product to the larger product. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.3 User Characteristics&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Describes the features of the user community, including their expected expertise with software systems and the application domain. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.4 User Problem Statement&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;This section describes the essential problem(s) currently confronted by the user community. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.5 User Objectives&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;This section describes the set of objectives and requirements for the system from the user's perspective. It may include a "wish list" of desirable characteristics, along with more feasible solutions that are in line with the business objectives. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.6 General Constraints&lt;/em&gt;&lt;/strong&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;Lists general constraints placed upon the design team, including speed requirements, industry protocols, hardware platforms, and so forth. &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;3. Functional Requirements&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br/&gt;&lt;/span&gt;This section lists the functional requirements in ranked order. Functional requirements describes the possible effects of a software system, in other words, what the system must accomplish. Other kinds of requirements (such as interface requirements, performance requirements, or reliability requirements) describe how the system accomplishes its functional requirements. Each functional requirement should be specified in a format similar to the following: &lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;ol&gt;&lt;li&gt;Short, imperative sentence stating highest ranked functional requirement.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Description&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;A full description of the requirement. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Criticality&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes how essential this requirement is to the overall system. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Technical issues&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes any design or implementation issues involved in satisfying this requirement. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Cost and schedule&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the relative or absolute costs associated with this issue. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Risks&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the circumstances under which this requirement might not able to be satisfied, and what actions can be taken to reduce the probability of this occurrence. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Dependencies with other requirements&lt;br/&gt;Describes interactions with other requirements. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;... others as appropriate&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;b) &amp;lt;Name of second highest ranked requirement&amp;gt;&lt;br/&gt;And so forth... &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;4. Interface Requirements&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;This section describes how the software interfaces with other software products or users for input or output. Examples of such interfaces include library routines, token streams, shared memory, data streams, and so forth. &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.1 User Interfaces&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes how this product interfaces with the user. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.1.1 GUI&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the graphical user interface if present. This section should include a set of screen dumps or mockups to illustrate user interface features. &lt;br/&gt;If the system is menu-driven, a description of all menus and their components should be provided. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.1.2 CLI&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the command-line interface if present. For each command, a description of all arguments and example values and invocations should be provided. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.1.3 API&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes the application programming interface, if present. For each public interface function, the name, arguments, return values, examples of invocation, and interactions with other functions should be provided. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.1.4 Diagnostics or ROM&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes how to obtain debugging information or other diagnostic data. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.2 Hardware Interfaces&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes interfaces to hardware devices. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.3 Communications Interfaces&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes network interfaces. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.4 Software Interfaces&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Describes any remaining software interfaces not included above. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;5. Performance Requirements&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;Specifies speed and memory requirements. &lt;br /&gt;&lt;/p&gt;&lt;h1&gt;6. Design Constraints&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;Specifies any constraints for the design team using this document. &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;6.1 Standards Compliance&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;&lt;em&gt;6.2 Hardware Limitations&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;... others as appropriate&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;7. Other non-functional attributes&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;Specifies any other particular non-functional attributes required by the system. Examples are provided below. &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;7.1 Security&lt;br/&gt;7.2 Binary Compatibility&lt;br/&gt;7.3 Reliability&lt;br/&gt;7.4 Maintainability&lt;br/&gt;7.5 Portability&lt;br/&gt;7.6 Extensibility&lt;br/&gt;7.7 Reusability&lt;br/&gt;7.8 Application Affinity/Compatibility&lt;br/&gt;7.9 Resource Utilization&lt;br/&gt;7.10 Serviceability&lt;br/&gt;... others as appropriate&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;8. Preliminary Object-Oriented Domain Analysis&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;This section presents a list of the fundamental objects that must be modelled within the system to satisfy its requirements. The purpose is to provide an alternative, "structural" view on the requirements stated above and how they might be satisfied in the system. &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.1 Inheritance Relationships&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;This section should contain a set of graphs that illustrate the primary inheritance hierarchy (is-kind-of) for the system.&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2 Class descriptions&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;This section presents a more detailed description of each class identified during the OO Domain Analysis. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Each class description should conform to the following structure: &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1 &amp;lt;Class name&amp;gt;&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.1 Abstract or Concrete: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Indicates whether this class is abstract or concrete. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.2 List of Superclasses: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Names all immediate superclasses. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.3 List of Subclasses: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Names all immediate subclasses. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.4 Purpose: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;States the basic purpose of the class. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.5 Collaborations: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Names each class with which this class must interact in order to accomplish its purpose, and how. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.6 Attributes: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Lists each attribute (state variable) associated with each instance of this class, and indicates examples of possible values (or a range). &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.7 Operations: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Lists each operation that can be invoked upon instances of this class. For each operation, the arguments (and their type), the return value (and its type), and any side effects of the operation should be specified. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;8.2.1.8 Constraints: &lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Lists any restrictions upon the general state or behavior of instances of this class. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;9. Operational Scenarios&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;This section should describe a set of scenarios that illustrate, from the user's perspective, what will be experienced when utilizing the system under various situations. &lt;br/&gt;In the article Inquiry-Based Requirements Analysis (IEEE Software, March 1994), scenarios are defined as follows: &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;In the broad sense, a scenario is simply a proposed specific use of the system. More specifically, a scenario is a description of one or more end-to-end transactions involving the required system and its environment. Scenarios can be documented in different ways, depending up on the level of detail needed. The simplest form is a use case, which consists merely of a short description with a number attached. More detailed forms are called scripts. These are usually represented as tables or diagrams and involved identifying an action and the agent (doer) of the action. FOr this reason, a script can also be called an action table. &lt;br/&gt;Although scenarios are useful in acquiring and validating requirements, they are not themselves requirements, because the describe the system's behavior only in specific situations; a specification, on the other hand, describes what the system should do in general. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;10. Preliminary Schedule&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;This section provides an initial version of the project plan, including the major tasks to be accomplished, their interdependencies, and their tentative start/stop dates. The plan also includes information on hardware, software, and wetware resource requirements. &lt;br/&gt;The project plan should be accompanied by one or more PERT or GANTT charts. &lt;br /&gt;&lt;/p&gt;&lt;h1&gt;11. Preliminary Budget&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;This section provides an initial budget for the project, itemized by cost factor. &lt;br /&gt;&lt;/p&gt;&lt;h1&gt;12. Appendices&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;&lt;br/&gt;Specifies other useful information for understanding the requirements. All SRS documents should include at least the following two appendices: &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;12.1 Definitions, Acronyms, Abbreviations&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Provides definitions of unfamiliar definitions, terms, and acronyms. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;12.2 References&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;Provides complete citations to all documents and meetings referenced or used in the preparation of this document. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-4444073695184850433?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/4444073695184850433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=4444073695184850433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4444073695184850433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4444073695184850433'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/structure-of-software-requirements.html' title='Structure of Software Requirements Specification Document'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-2644825781431925914</id><published>2008-03-13T17:37:00.001+05:30</published><updated>2008-03-13T17:37:08.120+05:30</updated><title type='text'>Ajax An Overview</title><content type='html'>&lt;span xmlns=''&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;AJAX is a cross-platform technique that can be use on different operating system and web application based on JavaScript and DOM. It is a powerful approach of web application technique using client-side scripting to exchange data with the web server. This means that with AJAX, web pages increases interactivity and faster responsiveness of user interface by having an independent communication with the server. Gone are the traditional ways of web browsing whereby a new page communicates with each user's request. This creates dynamic web application user interface that renders effective usability of every desktop applications. AJAX primary purpose is to increase the web page's interactivity, speed, functionality, and usability.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;Ajax, by definition, is not technology. In fact, it is an application of several technologies. Ajax incorporates several existing web application like XHTML and CSS for standard-based presentation; the Document Object Model for dynamic display and interaction; XML and XSLT for data interchange between the server and the client; the XMLHttpRequest to exchange asynchronous data with the web server; and the use of JavaScript as the core code for running AJAX application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;To understand AJAX, first we must know how the traditional web application works. The classic web interface trigger an HTTP request back to web server. The server then process and retrieve data before returning an HTML page to the users. This process as a model for hypertext medium makes technical sense. But as web application evolves this process does not make the user interface more interactive and practical.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;AJAX, on the other hand, eliminates this problem. AJAX speed up the loading of any web application with the use of intermediary between the user and the server called AJAX engine. This adding of another layer application of eliminates the start-stop-start-stop nature on the web. The browser loads an AJAX engine at the start of session.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;The AJAX engine allows the user interface and the application to interchange data asynchronously-independent of the communication to the server. So the interaction between the user and the web never slows down, no point of waiting for the server to do something.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 18pt'&gt;&lt;span style='color:#4b4b4b; font-family:Verdana; font-size:10pt'&gt;AJAX is a powerful technique that grows exceedingly as web application. That is, AJAX is now part of the guiding principle as web 2.0 flourishes and become a practical reality. With the power of AJAX, many of the business and marketing web site are integrated with AJAX application server platform now. Most of the major products of Google such as Gmail, Google Maps, and Google Suggest are employing AJAX application. Other web services like the photo-sharing application Flickr, Amazon's A9.com, and the new Yahoo! maps depends on AJAX. The application of AJAX comes from simple function to the most complex program like Google Maps.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-2644825781431925914?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/2644825781431925914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=2644825781431925914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/2644825781431925914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/2644825781431925914'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/ajax-overview.html' title='Ajax An Overview'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-8302188703520605518</id><published>2008-03-06T15:17:00.001+05:30</published><updated>2008-03-06T15:17:52.698+05:30</updated><title type='text'>How to use transaction in LINQ using C#</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt; I looked in to the LINQ and found very interesting. LINQ generates DataContext class which provides classes and methods which is used in OR-Mapping. You can also use your own stored procedures and views with LINQ. You may require using transaction with your own Stored Procedures for Insert, Delete or updating operations. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#333333'&gt;System.Data.Common.&lt;/span&gt;&lt;span style='color:#2b91af'&gt;DbTransaction &lt;/span&gt;&lt;span style='color:#333333'&gt;class provides the Transaction object. &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;Lets start with new project, you can select new project from Start -&amp;gt; All Programs -&amp;gt; Microsoft Visual Studio 2008and click on Microsoft Visual Studio 2008. Create new Asp.net website. Right click on website from solution explorer and select LINQ to SQL classes from Add New Item.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;This will generate dbml file in App_Code folder. Select the tables, views, stored procedures and function from server explorer and drag it on dbml file. DataContext class generates methods for each SPs, functions and views. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#333333'&gt;System.Data.Common.&lt;/span&gt;&lt;span style='color:#2b91af'&gt;DbTransaction&lt;/span&gt;&lt;span style='color:#333333'&gt; trans = &lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:#333333'&gt;;&lt;br/&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#2b91af'&gt;DataClassesDataContext&lt;/span&gt;&lt;span style='color:#333333'&gt; objDataClass = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;span style='color:#2b91af'&gt;DataClassesDataContext();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 36pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:blue'&gt;try&lt;br/&gt;&lt;/span&gt;&lt;span style='color:#333333'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#333333'&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style='color:#008040'&gt;// Open the connection&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br/&gt;objDataClass.Connection.Open();&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style='color:#008040'&gt;// Begin the transaction&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br/&gt;trans = objDataClass.Connection.BeginTransaction();&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style='color:#008040'&gt;// Assign transaction to context class&lt;br/&gt;// All the database operation perform by this object&lt;br/&gt;//will now use transaction&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br/&gt;objDataClass.Transaction = trans;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;//Perform the Operations &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;///Insert &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;//Update&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;//Delete&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 36pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:blue'&gt;catch&lt;/span&gt;&lt;span style='color:#333333'&gt; (&lt;/span&gt;&lt;span style='color:#2b91af'&gt;Exception&lt;/span&gt;&lt;span style='color:#333333'&gt; ex)&lt;br/&gt;{ &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 72pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#008040'&gt;// Rollback transaction&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:#333333'&gt; (trans != &lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:#333333'&gt;)&lt;br/&gt;trans.Rollback();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 36pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#333333'&gt;}&lt;br/&gt;&lt;/span&gt;&lt;span style='color:blue'&gt;finally&lt;br/&gt;&lt;/span&gt;&lt;span style='color:#333333'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 36pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:#008040'&gt;// Close the connection&lt;/span&gt;&lt;span style='color:#333333'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 36pt'&gt;&lt;span style='font-family:Verdana; font-size:12pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:#333333'&gt; (objDataClass.Connection.State == &lt;/span&gt;&lt;span style='color:#2b91af'&gt;ConnectionState&lt;/span&gt;&lt;span style='color:#333333'&gt;.Open)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='margin-left: 108pt'&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;objDataClass.Connection.Close();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='color:#333333; font-family:Verdana; font-size:12pt'&gt;Fig -  Code for Transaction in LINQ using C#&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-8302188703520605518?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/8302188703520605518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=8302188703520605518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8302188703520605518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8302188703520605518'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/how-to-use-transaction-in-linq-using-c.html' title='How to use transaction in LINQ using C#'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-3841164936492047068</id><published>2008-03-05T15:06:00.001+05:30</published><updated>2008-03-05T15:06:21.706+05:30</updated><title type='text'>Linq Performance Test</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;a title='Permalink to  LINQ vs Loop - A performance test' href='http://ox.no/posts/linq-vs-loop-a-performance-test'&gt;&lt;span style='color:blue; font-family:Times New Roman; font-size:18pt; text-decoration:underline'&gt;&lt;strong&gt;LINQ vs Loop - A performance test&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;strong&gt;&lt;br /&gt;					&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt; The future holds for C#. The addition of LINQ has brought a variety of query keywords to the language. "Anything" can be queried; Collections, DataTables,  SQL databases, XML documents, and Arrays. Custom queryable objects can also be created by implementing IQueryable. But all this costs you. The question is how much? &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;I decided to create a simple test to see how much of a performance hit LINQ is. The simple test I deviced finds the numbers in an array that are less than 10. The code is quoted below.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;static&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;void&lt;/span&gt; Main(&lt;span style='color:blue'&gt;string&lt;/span&gt;[] args)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    &lt;span style='color:blue'&gt;const&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; SIZE = 100000, RUNS = 10000;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:blue'&gt;int&lt;/span&gt;[] intData = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt;[SIZE];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:blue'&gt;for&lt;/span&gt; (&lt;span style='color:blue'&gt;int&lt;/span&gt; i = 0; i &amp;lt; SIZE; i++)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            intData[i] = i;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;     &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt; dtStartTime = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:blue'&gt;for&lt;/span&gt; (&lt;span style='color:blue'&gt;int&lt;/span&gt; t = 0; t &amp;lt; RUNS; ++t)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            &lt;span style='color:blue'&gt;int&lt;/span&gt;[] less = (&lt;span style='color:blue'&gt;from&lt;/span&gt; xData &lt;span style='color:blue'&gt;in&lt;/span&gt; intData&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                             &lt;span style='color:blue'&gt;where&lt;/span&gt; xData &amp;lt; 10&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;select&lt;/span&gt; xData).ToArray();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt; dtCompletTime = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now - dtStartTime;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:blue'&gt;string&lt;/span&gt;.Format(&lt;span style='color:#a31515'&gt;"LINQ: {0}, avg. {1}"&lt;/span&gt;, &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            dtCompletTime, &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt;(dtCompletTime.Ticks / RUNS)));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;     &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt; dtStartTimeFor2 = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:blue'&gt;for&lt;/span&gt; (&lt;span style='color:blue'&gt;int&lt;/span&gt; t = 0; t &amp;lt; RUNS; ++t)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            &lt;span style='color:blue'&gt;var&lt;/span&gt; l = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;List&lt;/span&gt;&amp;lt;&lt;span style='color:blue'&gt;int&lt;/span&gt;&amp;gt;();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            &lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:blue'&gt;var&lt;/span&gt; i &lt;span style='color:blue'&gt;in&lt;/span&gt; intData)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                &lt;span style='color:blue'&gt;if&lt;/span&gt; (i &amp;lt; 10)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    l.Add(i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            &lt;span style='color:blue'&gt;int&lt;/span&gt;[] less2 = l.ToArray();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;     &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt; dtCompletTimeFor2 = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now - dtStartTimeFor2;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        &lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:blue'&gt;string&lt;/span&gt;.Format(&lt;span style='color:#a31515'&gt;"Loop: {0}, avg. {1}"&lt;/span&gt;, &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            dtCompletTimeFor2, &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt;(dtCompletTimeFor2.Ticks / RUNS)));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.ReadLine();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Initially, I assumed the performance impact would not be too large, since its equivalent is the straightforward imperative loop, which should not be too hard for a compiler to deduce given static typing and a single collection to iterate across. Or?&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style='color:black; font-family:Courier New; font-size:12pt'&gt;LINQ: 00:00:23.4539536, avg. 00:00:00.0023453&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='color:black; font-family:Courier New; font-size:12pt'&gt;Loop: 00:00:10.5456736, avg. 00:00:00.0010545&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;As you can see, the performance impact is huge. LINQ performs 50 times worse than the traditional loop! This seems rather wild at first glance, but the explanation is this: The keywords introduced by LINQ are syntactic sugar for method invocations to a set of generic routines for iterating across collections and filtering through lambda expressions. Naturally, this will not perform as good as a traditional imperative loop, and less optimization is possible.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Using Linq With Array List&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;static&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;void&lt;/span&gt; Main(&lt;span style='color:blue'&gt;string&lt;/span&gt;[] args)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;  {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:#a31515'&gt;"Using Linq on Array List"&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;ArrayList&lt;/span&gt; arrList = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;ArrayList&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        arrList.Add(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Student&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                FirstName = &lt;span style='color:#a31515'&gt;"Mehul"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                LastName = &lt;span style='color:#a31515'&gt;"Talajia"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                Scores = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt;[] { 98, 92, 81, 60 }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            });&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        arrList.Add(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Student&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                FirstName = &lt;span style='color:#a31515'&gt;"Anil"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                LastName = &lt;span style='color:#a31515'&gt;"Patel"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                Scores = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt;[] { 75, 84, 91, 39 }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            });&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        arrList.Add(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Student&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                FirstName = &lt;span style='color:#a31515'&gt;"Pranav"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                LastName = &lt;span style='color:#a31515'&gt;"Vyas"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                Scores = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt;[] { 88, 94, 65, 91 }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            });&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        arrList.Add(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Student&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                FirstName = &lt;span style='color:#a31515'&gt;"Piyush"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                LastName = &lt;span style='color:#a31515'&gt;"Gohel"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                Scores = &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt;[] { 97, 89, 85, 82 }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            });&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt; dtStartArrayLINQ = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;var&lt;/span&gt; query = &lt;span style='color:blue'&gt;from&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Student&lt;/span&gt; student &lt;span style='color:blue'&gt;in&lt;/span&gt; arrList&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;where&lt;/span&gt; student.Scores[0] &amp;gt; 95&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;select&lt;/span&gt; student;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:#2b91af'&gt;Student&lt;/span&gt; s &lt;span style='color:blue'&gt;in&lt;/span&gt; query)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(s.LastName + &lt;span style='color:#a31515'&gt;": "&lt;/span&gt; + s.Scores[0]);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt; dtEndArrayLinq = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now - dtStartArrayLINQ;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; intTmpTicks = 4;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt; dtStartArrayLoop = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:#2b91af'&gt;Student&lt;/span&gt; a &lt;span style='color:blue'&gt;in&lt;/span&gt; arrList)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;if&lt;/span&gt; (a.Scores[0] &amp;gt; 95)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(a.LastName + &lt;span style='color:#a31515'&gt;": "&lt;/span&gt; + a.Scores[0]);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt; dtEndArrayLoop = &lt;span style='color:#2b91af'&gt;DateTime&lt;/span&gt;.Now - dtStartArrayLoop;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;     &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:blue'&gt;string&lt;/span&gt;.Format(&lt;span style='color:#a31515'&gt;"LINQ: {0}, avg. {1}"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            dtEndArrayLinq , &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt;(dtEndArrayLinq.Ticks  / intTmpTicks)));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;     &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:blue'&gt;string&lt;/span&gt;.Format(&lt;span style='color:#a31515'&gt;"Loop: {0}, avg. {1}"&lt;/span&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;      dtEndArrayLoop , &lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;TimeSpan&lt;/span&gt;(dtEndArrayLoop.Ticks / intTmpTicks)));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;					&lt;span style='color:#2b91af'&gt;Console&lt;/span&gt;.Read();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;  }&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style='font-family:Courier New; font-size:12pt'&gt;LINQ: 00:00:00.0467946, avg. 00:00:00.0116986&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Courier New; font-size:12pt'&gt;Loop: 00:00:00, avg. 00:00:00&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Having seen the performance impact, I am still of the view that LINQ is a great step towards a more declarative world for developers. Instead of saying "take these numbers, iterate over all of them, and insert them into this list if they are less than ten", which is an informal description of a classical imperative loop, you can now say "from these numbers, give me those that are less than ten". The difference may be subtle, but the latter is in my opinion far more declarative and easy to read. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;This may very well be the next big thing, but it comes at a cost. So far, my advice is to create simple performance tests for the cases where you consider adopting LINQ, to spot possible pitfalls as early as possible.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-3841164936492047068?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/3841164936492047068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=3841164936492047068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/3841164936492047068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/3841164936492047068'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/linq-performance-test.html' title='Linq Performance Test'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-6778075674398898681</id><published>2008-03-04T18:46:00.001+05:30</published><updated>2008-03-04T18:46:04.896+05:30</updated><title type='text'>Free .NET3.5 C# Ajax Books </title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Free .NET 3.5 C# Books&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Ajax Foundation  Free E-Bool    &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://rapidshare.com/files/96917539/Foundations_Of_Ajax__2005_.pdf'&gt;http://rapidshare.com/files/96917539/Foundations_Of_Ajax__2005_.pdf&lt;/a&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;C# 2008  Free E-Book &lt;br /&gt;&lt;/p&gt;&lt;p&gt;http://rapidshare.com/files/95627537/Pro_C_2008_and_the_NET_3_5_Platform_Fourth_Edition-3783.zip&lt;br /&gt;&lt;/p&gt;&lt;p&gt;http://rapidshare.com/files/95629422/_new__www.free-ebooks-download.org-...ro_ASP.NET_3.5_in_C__2008.zip&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-6778075674398898681?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/6778075674398898681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=6778075674398898681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6778075674398898681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6778075674398898681'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/03/free-net35-c-ajax-books.html' title='Free .NET3.5 C# Ajax Books '/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-4317642923205818279</id><published>2008-02-28T19:18:00.002+05:30</published><updated>2008-02-28T19:20:58.446+05:30</updated><title type='text'>Coding Standards</title><content type='html'>&lt;span xmlns=""&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Introduction&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;Anybody can write code. With a few months of programming experience, you can write 'working applications'. Making it work is easy, but doing it the right way requires more work, than just making it work.&lt;br /&gt;&lt;br /&gt;Believe it, majority of the programmers write 'working code', but not 'good code'. Writing 'good code' is an art and you must learn and practice it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Everyone may have different definitions for the term 'good code'. In my definition, the following are the characteristics of good code.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Reliable&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Maintainable&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Efficient&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Most of the developers are inclined towards writing code for higher performance, compromising reliability and maintainability. But considering the long term ROI (Return On Investment), efficiency and performance comes below reliability and maintainability. If your code is not reliable and maintainable, you (and your company) will be spending lot of time to identify issues, trying to understand code etc throughout the life of your application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Purpose of coding standards and best practices&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;To develop reliable and maintainable applications, you must follow coding standards and best practices.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;The naming conventions, coding standards and best practices described in this document are compiled from our own experience and by referring to various Microsoft and non Microsoft guidelines.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;There are several standards exists in the programming industry. None of them are wrong or bad and you may follow any of them. What is more important is, selecting one standard approach and ensuring that everyone is following it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;How to follow the standards across the team&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;If you have a team of different skills and tastes, you are going to have a tough time convincing everyone to follow the same standards. The best approach is to have a team meeting and developing your own standards document. You may use this document as a template to prepare your own document.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Distribute a copy of this document (or your own coding standard document) well ahead of the coding standards meeting. All members should come to the meeting prepared to discuss pros and cons of the various points in the document. Make sure you have a manager present in the meeting to resolve conflicts.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Discuss all points in the document. Everyone may have a different opinion about each point, but at the end of the discussion, all members must agree upon the standard you are going to follow. Prepare a new standards document with appropriate changes based on the suggestions from all of the team members. Print copies of it and post it in all workstations.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;After you start the development, you must schedule code review meetings to ensure that everyone is following the rules. 3 types of code reviews are recommended:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Peer review – another team member review the code to ensure that the code follows the coding standards and meets requirements. This level of review can include some unit testing also. Every file in the project must go through this process.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Architect review – the architect of the team must review the core modules of the project to ensure that they adhere to the design and there is no "big" mistakes that can affect the project in the long run.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Group review – randomly select one or more files and conduct a group review once in a week. Distribute a printed copy of the files to all team members 30 minutes before the meeting. Let them read and come up with points for discussion. In the group review meeting, use a projector to display the file content in the screen. Go through every sections of the code and let every member give their suggestions on how could that piece of code can be written in a better way. (Don't forget to appreciate the developer for the good work and also make sure he does not get offended by the "group attack"!)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Naming Conventions and Standards&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse: collapse;" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 590px;"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;Note :&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;The terms &lt;span style="text-decoration: underline;"&gt;Pascal Casing&lt;/span&gt; and &lt;span style="text-decoration: underline;"&gt;Camel Casing&lt;/span&gt; are used throughout this document.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;&lt;strong&gt;Pascal Casing &lt;/strong&gt;- First character of all words are Upper Case and other characters are lower case.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;Example: &lt;span style="text-decoration: underline;"&gt;B&lt;/span&gt;ack&lt;span style="text-decoration: underline;"&gt;C&lt;/span&gt;olor&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;&lt;strong&gt;Camel Casing - &lt;/strong&gt;First character of all words, &lt;span style="text-decoration: underline;"&gt;except the first word&lt;/span&gt; are Upper Case and other characters are lower case.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;Example: &lt;span style="text-decoration: underline;"&gt;b&lt;/span&gt;ack&lt;span style="text-decoration: underline;"&gt;C&lt;/span&gt;olor&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use Pascal casing for Class names&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;public class &lt;strong&gt;HelloWorld&lt;/strong&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;    ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use Pascal casing for Method names&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;void &lt;strong&gt;SayHello&lt;/strong&gt;(string name)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;    ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use Camel casing for variables and method parameters&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;int &lt;strong&gt;totalCount&lt;/strong&gt; = 0;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;void SayHello(string name)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;    string &lt;strong&gt;fullMessage&lt;/strong&gt; = "Hello " + name;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;    ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use the prefix "I" with Camel Casing for interfaces ( Example: &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;&lt;strong&gt;IEntity&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; )&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Do not use Hungarian notation to name variables&lt;/span&gt;&lt;span style="font-size:9;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;In earlier days most of the programmers liked it - having the data type as a prefix for the variable name and using m_ as prefix for member variables. Eg:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;string m_sName;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;int nAge;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;However, in .NET coding standards, this is not recommended. Usage of data type and m_ to represent member variables should not be used. All variables should use camel casing.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse: collapse;" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 590px;"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Some programmers still prefer to use the prefix &lt;strong&gt;m_&lt;/strong&gt; to represent member variables, since there is no other easy way to identify a member variable.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Use Meaningful, descriptive words to name variables. &lt;/span&gt;&lt;span style="font-size:9;"&gt;Do not use abbreviations.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;string address&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;int salary&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;string nam&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;string addr&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;int sal&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not use single character variable names like &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;i, n, s &lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;etc. Use names like &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;index, temp&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;One exception in this case would be variables used for iterations in loops:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;for ( int i = 0; i &amp;lt; count; i++ )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;    ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;If the variable is used only as a counter for iteration and is not used anywhere else in the loop, many people still like to use a single char variable (i) instead of inventing a different suitable name.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not use underscores (_) for local variable names.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;All member variables must be prefixed with underscore (_) so that they can be identified from other local variables.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not use variable names that resemble keywords.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Prefix &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;boolean&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; variables, properties and methods with "&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;is&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;" or similar prefixes.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 18pt;"&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Ex: &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;private bool _isFinished&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Namespace names should follow the standard pattern&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;&amp;lt;company name&amp;gt;.&amp;lt;product name&amp;gt;.&amp;lt;top level module&amp;gt;.&amp;lt;bottom level module&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Use appropriate prefix for the UI elements so that you can identify them from the rest of the variables.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;There are 2 different approaches recommended here.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Use a common prefix ( ui_ ) for all UI elements. This will help you group all of the UI elements together and easy to access all of them from the intellisense.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin-left: 18pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Use appropriate prefix for each of the ui element. A brief list is given below. Since .NET has given several controls, you may have to arrive at a complete list of standard prefixes for each of the controls (including third party controls) you are using.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="margin-left: 53pt;"&gt;&lt;table style="border-collapse: collapse;" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 189px;"&gt;&lt;col style="width: 133px;"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr style="height: 16px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;&lt;strong&gt;Control&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;color:black;"   &gt;&lt;strong&gt;Prefix&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Label&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;lbl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;TextBox&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;txt&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;DataGrid&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;dtg&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Button&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;btn&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;ImageButton&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;imb&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Hyperlink&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;hlk&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;DropDownList&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;ddl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;ListBox&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;lst&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;DataList&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;dtl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Repeater&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;rep&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Checkbox&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;chk&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;CheckBoxList&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;cbl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;RadioButton&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;rdo&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;RadioButtonList&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;rbl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Image&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;img&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Panel&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;pnl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;PlaceHolder&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;phd&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Table&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;tbl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 22px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Validators&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Val&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 22px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;&lt;strong&gt;DATA TYPES&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 22px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Integer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;int&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 14px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Double&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;dbl&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 19px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;String&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;str&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 24px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Char&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;chr&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 18px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Long&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;lng&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 17px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Unsigned Int&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;uint&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 23px;"&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Boolean&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;is&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;File name should match with class name.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;For example, for the class HelloWorld, the file name should be helloworld.cs (or, helloworld.vb)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use Pascal Case for file names.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Indentation and Spacing&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use TAB for indentation. Do not use SPACES.  Define the Tab size as 4.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Comments should be in the same level as the code (use the same level of indentation).&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;// Format a message and display&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;string fullMessage = "Hello " + name;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;DateTime currentTime = DateTime.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;MessageBox.Show ( message );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;// Format a message and display&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;string fullMessage = "Hello " + name;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;DateTime currentTime = DateTime.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 71pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;MessageBox.Show ( message );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Curly braces ( &lt;span style="color:blue;"&gt;{}&lt;/span&gt; ) should be in the same level as the code outside the braces.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use one blank line to separate logical groups of code.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    bool SayHello ( string name )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        string fullMessage = "Hello " + name;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        DateTime currentTime = DateTime.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        MessageBox.Show ( message );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        if ( ... )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            return false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        return true;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    bool SayHello (string name)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        string fullMessage = "Hello " + name;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        DateTime currentTime = DateTime.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        MessageBox.Show ( message );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        if ( ... )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            return false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        return true;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;There should be one and only one single blank line between each method inside the class.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;The curly braces should be on a separate line and not in the same line as &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;if, for&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt; etc.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        if ( ... )   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        if ( ... )    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use a single space before and after each operator and brackets.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        if ( showResult == true )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            for ( int i = 0; i &amp;lt; 10; i++ )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                //&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        if(showResult==true)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            for(int       i= 0;i&amp;lt;10;i++)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                //&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;#region&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; to group related pieces of code together. If you use proper grouping using &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;#region&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;, the page should like this when all definitions are collapsed.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Keep private member variables, properties and methods in the top of the file and public members in the bottom. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Good Programming practices&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Avoid writing very long methods. A method should typically have 1~25 lines of code. If a method has more than 25 lines of code, you must consider re factoring into separate methods.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Method name should tell what it does. Do not use mis-leading names. If the method name is obvious, there is no need of documentation explaining what the method does.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    void SavePhoneNumber ( string phoneNumber )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        // Save the phone number.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    // This method will save the phone number.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    void SaveDetails ( string phoneNumber )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Save the phone number.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;A method should do only 'one job'. Do not combine more than one job in a single method, even if those jobs are very small.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // Save the address.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    SaveAddress (  address );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // Send an email to the supervisor to inform that the address is updated.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    SendEmail ( address, email );       &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    void SaveAddress ( string address )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        // Save the address.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    void SendEmail ( string address, string email )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        // Send an email to inform the supervisor that the address is changed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    // Save address and send an email to the supervisor to inform that&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;// the address is updated.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    SaveAddress ( address, email );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    void SaveAddress ( string address, string email )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Job 1.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Save the address.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Job 2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Send an email to inform the supervisor that the address is changed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use the c# or VB.NET specific types (aliases), rather than the types defined in System namespace.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    int age;   (not &lt;strong&gt;I&lt;/strong&gt;nt&lt;strong&gt;16&lt;/strong&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    string name;  (not &lt;strong&gt;S&lt;/strong&gt;tring)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    object contactInfo; (not &lt;strong&gt;O&lt;/strong&gt;bject)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse: collapse;" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 590px;"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="padding-left: 7px; padding-right: 7px;"&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Some developers prefer to use types in Common Type System than language specific aliases.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Always watch for unexpected values. For example, if you are using a parameter with 2 possible values, never assume that if one is not matching then the only possibility is the other value.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;If ( memberType == eMemberTypes.Registered )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // Registered user… do something…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;else if ( memberType == eMemberTypes.Guest )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // Guest user... do something…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;else&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;{&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;        // Un expected user type. Throw an exception&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;        throw new Exception ("Un expected value " + memberType.ToString() + "'.")&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;        // If we introduce a new user type in future, we can easily find&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;// the problem here.&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;}&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;If ( memberType == eMemberTypes.Registered )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Registered user… do something…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        // Guest user... do something…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 71pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;// If we introduce another user type in future, this code will&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 71pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;// fail and will not be noticed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Do not hardcode numbers. Use constants instead.&lt;/span&gt;&lt;span style="font-size:9;"&gt; Declare constant in the top of the file and use it in your code.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;However, using constants are also not recommended. You should use the constants in the config file or database so that you can change it later. Declare them as constants only if you are sure this value will never need to be changed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not hardcode strings. Use resource files.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Convert strings to lowercase or upper case before comparing. This will ensure the string will match even if the string being compared has a different case.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;if ( name.ToLower() == "john" )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        //…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use String.Empty instead of ""&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;If ( name == String.Empty )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;If ( name == "" )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    // do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Avoid using member variables. Declare local variables wherever necessary and pass it to other methods instead of sharing a member variable between methods. If you share a member variable between methods, it will be difficult to track which method changed the value and when.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;enum&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; wherever required. Do not use numbers or strings to indicate discrete values.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    enum MailType&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        Html,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        PlainText,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        Attachment&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    void SendMail (string message, MailType mailType)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        switch ( mailType )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            case MailType.Html:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            case MailType.PlainText:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            case MailType.Attachment:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            default:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    void SendMail (string message, string mailType)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        switch ( mailType )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            case "Html":&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            case "PlainText":&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            case "Attachment":&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;            default:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                // Do something&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;                break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not make the member variables public or protected. Keep them private and expose public/protected Properties.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;The event handler should not contain the code to perform the required action. Rather call another method from the event handler.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not programmatically click a button to execute the same action you have written in the button click event. Rather, call the same method which is called by the button click event handler.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Never hardcode a path or drive name in code. Get the application path programmatically and use relative path.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Never assume that your code will run from drive "C:". You may never know, some users may run it from network or from a "Z:".&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style="margin-left: 18pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;In the application start up, do some kind of "self check" and ensure all required files and dependencies are available in the expected locations. Check for database connection in start up, if required. Give a friendly message to the user in case of any problems.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Error messages should help the user to solve the problem. Never give error messages like "Error in Application", "There is an error" etc. Instead give specific messages like "Failed to update database. Please make sure the login id and password are correct."&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;When displaying error messages, in addition to telling what is wrong, the message should also tell what should the user do to solve the problem. Instead of message like "Failed to update database.", suggest what should the user do: "Failed to update database. Please make sure the login id and password are correct."&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Show short and friendly message to the user. But log the actual error with all possible information. This will help a lot in diagnosing problems.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not have more than one class in a single file.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Have your own templates for each of the file types in Visual Studio. You can include your company name, copy right information etc in the template. You can view or edit the Visual Studio file templates in the folder &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\CSharp\1033&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;. (This folder has the templates for C#, but you can easily find the corresponding folders or any other language)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Avoid having very large files. If a single file has more than 1000 lines of code, it is a good candidate for refactoring. Split them logically into two or more classes.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Avoid public methods and properties, unless they really need to be accessed from outside the class. Use "internal" if they are accessed only within the same assembly.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Avoid passing too many parameters to a method. If you have more than 4~5 parameters, it is a good candidate to define a class or structure.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;If you have a method returning a collection, return an empty collection instead of null, if you have no data to return. For example, if you have a method returning an ArrayList, always return a valid ArrayList. If you have no items to return, then return a valid ArrayList with 0 items. This will make it easy for the calling application to just check for the "count" rather than doing an additional check for "null".&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Use the AssemblyInfo file to fill information like version number, description, company name, copyright notice etc.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:10;"&gt;Logically organize all your files within appropriate folders. Use 2 level folder hierarchies. You can have up to 10 folders in the root folder and each folder can have up to 5 sub folders. If you have too many folders than cannot be accommodated with the above mentioned 2 level hierarchy, you may need re factoring into multiple assemblies.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Make sure you have a good logging class which can be configured to log errors, warning or traces. If you configure to log errors, it should only log errors. But if you configure to log traces, it should record all (errors, warnings and trace). Your log class should be written such a way that in future you can change it easily to log to Windows Event Log, SQL Server, or Email to administrator or to a File etc without any change in any other part of the application. Use the log class extensively throughout the code to record errors, warning and even trace messages that can help you trouble shoot a problem.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;If you are opening database connections, sockets, file stream etc, always close them in the &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;finally&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; block. This will ensure that even if an exception occurs after opening the connection, it will be safely closed in the &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:blue;"   &gt;finally&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; block.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Declare variables as close as possible to where it is first used. Use one variable declaration per line.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use StringBuilder class instead of String when you have to manipulate string objects in a loop. The String object works in weird way in .NET. Each time you append a string, it is actually discarding the old string object and recreating a new object, which is a relatively expensive operations.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Consider the following example:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;public string ComposeMessage (string[] lines)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   string message = String.Empty;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   for (int i = 0; i &amp;lt; lines.Length; i++)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      message += lines [i];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   return message;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;In the above example, it may look like we are just appending to the string object 'message'. But what is happening in reality is, the string object is discarded in each iteration and recreated and appending the line to it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;If your loop has several iterations, then it is a good idea to use StringBuilder class instead of String object.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;See the example where the String object is replaced with StringBuilder.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;public string ComposeMessage (string[] lines)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    StringBuilder message = new StringBuilder();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    for (int i = 0; i &amp;lt; lines.Length; i++)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;       message.Append( lines[i] );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    return message.ToString();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;ASP.NET&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not use session variables throughout the code. Use session variables only within the classes and expose methods to access the value stored in the session variables. A class can access the session using &lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style=";font-family:Courier New;font-size:9;"  &gt;System.Web.HttpCOntext.Current.Session&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not store large objects in session. Storing large objects in session may consume lot of server memory depending on the number of users.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Always use style sheet to control the look and feel of the pages. Never specify font name and font size in any of the pages. Use appropriate style class. This will help you to change the UI of your application easily in future. Also, if you like to support customizing the UI for each customer, it is just a matter of developing another style sheet for them&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Comments&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good and meaningful comments make code more maintainable. However,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not write comments for every line of code and every variable declared.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Use &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;//&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; or &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;&lt;strong&gt;///&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt; for comments. Avoid using &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;&lt;strong&gt;/* … */&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Write comments wherever required. But good readable code will require very less comments. If all variables and method names are meaningful, that would make the code very readable and will not need many comments.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Do not write comments if the code is easily understandable without comment. The drawback of having lot of comments is, if you change the code and forget to change the comment, it will lead to more confusion.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Fewer lines of comments will make the code more elegant. But if the code is not clean/readable and there are less comments, that is worse.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;If you have to use some complex or weird logic for any reason, document it very well with sufficient comments.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;If you initialize a numeric variable to a special number other than 0, -1 etc, document the reason for choosing that value.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;The bottom line is, write clean, readable code such a way that it doesn't need any comments to understand.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:9;"&gt;Perform &lt;/span&gt;&lt;span style="font-size:10;"&gt;spelling check on comments and also make sure proper grammar and punctuation is used.&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: rgb(0, 51, 204);font-family:Arial;font-size:12;"  &gt;&lt;strong&gt;Exception Handling&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Never do a 'catch exception and do nothing'. If you hide an exception, you will never know if the exception happened or not. Lot of developers uses this handy method to ignore non significant errors. You should always try to avoid exceptions by checking all the error conditions programmatically. In any case, catching an exception and doing nothing is not allowed. In the worst case, you should log the exception and proceed.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;In case of exceptions, give a friendly message to the user, but log the actual error with all possible details about the error, including the time it occurred, method and class name etc.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;Always catch only the specific exception, not generic exception.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    void ReadFromFile ( string fileName )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        try&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            // read from file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        catch (FileIOException ex)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            // log error.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            //  re-throw exception depending on your case.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;            throw;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;void ReadFromFile ( string fileName )&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   try&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      // read from file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   catch (Exception ex)   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      // Catching general exception is bad... we will never know whether&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      // it was a file error or some other error.       &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      // Here you are hiding an exception.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      // In this case no one will ever know that an exception happened.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;      return "";       &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;   }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 35pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;No need to catch the general exception in all your methods. Leave it open and let the application crash. This will help you find most of the errors during development cycle. You can have an application level (thread level) error handler where you can handle all general exceptions. In case of an 'unexpected general error', this error handler should catch the exception and should log the error in addition to giving a friendly message to the user before closing the application, or allowing the user to 'ignore and proceed'.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:9;"&gt;&lt;span style="font-family:Arial;"&gt;When you re throw an exception, use the &lt;/span&gt;&lt;span style=";font-family:Courier New;color:blue;"  &gt;throw&lt;/span&gt;&lt;span style="font-family:Arial;"&gt; statement without specifying the original exception. This way, the original call stack is preserved.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 17pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;catch&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    // do whatever you want to handle the exception&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;    throw;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:green;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Not Good:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;catch (Exception ex)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    // do whatever you want to handle the exception&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;    throw ex;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt;"&gt;&lt;span style=";font-family:Courier New;font-size:9;color:red;"   &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Do not write try-catch in all your methods. Use it only if there is a possibility that a specific exception may occur and it cannot be prevented by any other means. For example, if you want to insert a record if it does not already exists in database, you should try to select record using the key. Some developers try to insert a record without checking if it already exists. If an exception occurs, they will assume that the record already exists. This is strictly not allowed. You should always explicitly check for errors rather than waiting for exceptions to occur. On the other hand, you should always use exception handlers while you communicate with external systems like network, hardware devices etc. Such systems are subject to failure anytime and error checking is not usually reliable. In those cases, you should use exception handlers and try to recover from error.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Do not write very large try-catch blocks. If required, write separate try-catch for each task you perform and enclose only the specific piece of code inside the try-catch. This will help you find which piece of code generated the exception and you can give specific error message to the user.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Arial;font-size:9;"  &gt;Write your own custom exception classes if required in your application. Do not derive your custom exceptions from the base class SystemException. Instead, inherit from ApplicationException.&lt;/span&gt;&lt;br /&gt;    &lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-4317642923205818279?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/4317642923205818279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=4317642923205818279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4317642923205818279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/4317642923205818279'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/02/introduction-anybody-can-write-code.html' title='Coding Standards'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-8848808303274397947</id><published>2008-02-14T21:00:00.005+05:30</published><updated>2008-02-14T22:03:17.927+05:30</updated><title type='text'>Extension method</title><content type='html'>&lt;p&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;br /&gt;Extension methods enable you to "add" methods to existing types without creating&lt;br /&gt;a new derived type, recompiling, or otherwise modifying the original type.&lt;br /&gt;Extension methods are a special kind of static method, but they are called as if&lt;br /&gt;they were instance methods on the extended type. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The most common extension methods are the LINQ standard query operators that add&lt;br /&gt;query functionality to the existing &lt;?xml:namespace prefix = mshelp /&gt;&lt;mshelp:link tabindex="0" keywords="T:System.Collections.IEnumerable"&gt;System.Collections&lt;span class="cs"&gt;.&lt;/span&gt;&lt;span class="vb"&gt;.&lt;/span&gt;&lt;span class="cpp"&gt;::&lt;/span&gt;&lt;span class="nu"&gt;.&lt;/span&gt;IEnumerable&lt;/mshelp:link&gt;&lt;br /&gt;and &lt;span style="color:#000066;"&gt;&lt;mshelp:link tabindex="0" keywords="T:System.Collections.Generic.IEnumerable`1"&gt;System.Collections.Generic&lt;span class="nu"&gt;.&lt;/span&gt;IEnumerable&lt;span class="vb"&gt;(&lt;/span&gt;T&lt;span class="nu"&gt;)&lt;/span&gt;&lt;/mshelp:link&gt;&lt;br /&gt;&lt;/span&gt;types. To use the standard query operators, first bring them into scope with a&lt;br /&gt;&lt;span class="code"&gt;using &lt;span style="color:#000099;"&gt;System.Linq&lt;/span&gt;&lt;/span&gt; directive. Then any type that&lt;br /&gt;implements &lt;mshelp:link tabindex="0" keywords="T:System.Collections.Generic.IEnumerable`1"&gt;&lt;span style="color:#000099;"&gt;IEnumerable&lt;span class="nu"&gt;(&lt;/span&gt;T&lt;span class="nu"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/mshelp:link&gt; appears to have instance methods such as &lt;mshelp:link tabindex="0" keywords="Overload:System.Linq.Enumerable.GroupBy"&gt;&lt;span style="color:#000099;"&gt;GroupBy&lt;/span&gt;&lt;/mshelp:link&gt;,&lt;br /&gt;&lt;mshelp:link tabindex="0" keywords="Overload:System.Linq.Enumerable.OrderBy"&gt;&lt;span style="color:#000099;"&gt;OrderBy&lt;/span&gt;&lt;/mshelp:link&gt;, &lt;mshelp:link tabindex="0" keywords="Overload:System.Linq.Enumerable.Average"&gt;&lt;span style="color:#000099;"&gt;Average&lt;/span&gt;&lt;/mshelp:link&gt;, and so on. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;You can see these additional methods in IntelliSense statement completion when&lt;br /&gt;you type "dot" after an instance of an &lt;mshelp:link tabindex="0" keywords="T:System.Collections.Generic.IEnumerable`1"&gt;IEnumerable&lt;span class="nu"&gt;(&lt;/span&gt;T&lt;span class="nu"&gt;)&lt;/span&gt;&lt;/mshelp:link&gt; type such as &lt;mshelp:link tabindex="0" keywords="T:System.Collections.Generic.List`1"&gt;List&lt;span class="nu"&gt;(&lt;/span&gt;T&lt;span class="nu"&gt;)&lt;/span&gt;&lt;/mshelp:link&gt; or &lt;mshelp:link tabindex="0" keywords="T:System.Array"&gt;Array&lt;/mshelp:link&gt;. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The following example shows how to call the standard query operator &lt;b&gt;&lt;span style="color:#000099;"&gt;OrderBy&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;method on an array of integers. The expression in parentheses is a lambda&lt;br /&gt;expression. Many standard query operators take lambda expressions as parameters,&lt;br /&gt;but this is not a requirement for extension methods.&lt;br /&gt;&lt;span codelanguage="CSharp"&gt;&lt;br /&gt;&lt;table cellspacing="0" cellpadding="0" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="keyword"  xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" style="color:#000099;"&gt;class&lt;/span&gt; ExtensionMethods2&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:#000099;"&gt;&lt;span class="keyword"&gt;static&lt;/span&gt; &lt;span class="keyword"&gt;void&lt;/span&gt;&lt;/span&gt; Main()&lt;br /&gt;    {    &lt;br /&gt;        &lt;span style="color:#000099;"&gt;int&lt;/span&gt;[] ints = { 10, 45, 15, 39, 21, 26 };&lt;br /&gt;        &lt;span style="color:#000099;"&gt;var&lt;/span&gt; result = ints.OrderBy(g =&amp;gt; g);&lt;br /&gt;        &lt;span class="keyword"  style="color:#000099;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#000099;"&gt;var&lt;/span&gt; i &lt;span class="keyword"  style="color:#000099;"&gt;in&lt;/span&gt; result)&lt;br /&gt;        {&lt;br /&gt;            System.Console.Write(i + &lt;span class="literal"&gt;" "&lt;/span&gt;);&lt;br /&gt;        }   &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span class="comment" xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"&gt;//Output: 10 15 21 26 39 45&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;br /&gt;Extension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the modifier.&lt;br /&gt;Extension methods are only in scope when you explicitly import the namespace&lt;br /&gt;into your source code with a using directive.&lt;/p&gt;&lt;p&gt;The following example shows an extension method defined for the System.String class. Note that it is defined inside a non-nested, non-generic static class:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;namespace&lt;/span&gt; ExtensionMethods&lt;br /&gt;{&lt;/p&gt;&lt;p&gt;         &lt;span style="color:#000099;"&gt; public static class&lt;/span&gt; MyExtensions &lt;/p&gt;&lt;p&gt;         {  &lt;/p&gt;&lt;p&gt;                 &lt;span style="color:#000099;"&gt; public static int&lt;/span&gt; WordCount(this String str) &lt;/p&gt;&lt;p&gt;                 {&lt;br /&gt;                        &lt;span style="color:#000099;"&gt;return&lt;/span&gt; str.Split( char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;                  } &lt;/p&gt;&lt;p&gt;        } &lt;/p&gt;&lt;p&gt;}&lt;br /&gt;&lt;span style="color:#000099;"&gt;using &lt;/span&gt;ExtensionMethods;&lt;br /&gt;&lt;span style="color:#000099;"&gt;string&lt;/span&gt; s = "Hello Extension Methods";&lt;br /&gt;&lt;span style="color:#000099;"&gt;int&lt;/span&gt; i = s.WordCount();&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In code you invoke the extension method with instance method syntax. However, the intermediate language (IL) generated by the compiler translates your code into a call on the static method. Therefore, the principle of encapsulation is not really being violated. In fact, &lt;span style="color:#ff0000;"&gt;extension methods cannot access private variables in the type they are extending.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;In general, you will probably be calling extension methods far more often than implementing your own. Because extension methods are called by using instance method syntax, no special knowledge is required to use them from client code. To enable extension methods for a particular type, just add a &lt;span class="keyword"&gt;using&lt;/span&gt; directive for the namespace in which the methods are defined. For example, to use the standard query operators, add this &lt;span class="keyword"&gt;using&lt;/span&gt; directive to your code:&lt;/p&gt;&lt;p class="heading"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;Binding Extension Methods at Compile Time&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;You can use extension methods to extend a class or interface, but not to override them. An extension method with the same name and signature as an interface or class method will never be called. At compile time, extension methods always have lower priority than instance methods defined in the type itself. In other words, if a type has a method named P_Operation&lt;span class="code"&gt;(int i)&lt;/span&gt;, and you have an extension method with the same signature, the compiler will always bind to the instance method. When the compiler encounters a method invocation, it first looks for a match in the type's instance methods. If no match is found, it will search for any extension methods that are defined for the type, and bind to the first extension method that it finds&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#993300;"&gt;General Guidelines&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;In general, I recommend that you implement extension methods sparingly and only&lt;br /&gt;when you have to. Whenever possible, client code that must extend an existing&lt;br /&gt;type should do so by creating a new type derived from the existing type.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;When using an extension method to extend a type whose source code you cannot change, you run the risk that a change in the implementation of the type will cause your extension method to break.&lt;/p&gt;&lt;br /&gt;&lt;div class="section" id="sectionSection1" name="collapseableSection"&gt;&lt;p&gt;If you do implement extension methods for a given type, remember the following&lt;br /&gt;two points:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;An extension method will never be called if it has the same signature as a&lt;br /&gt;method defined in the type.&lt;/li&gt;&lt;li&gt;&lt;p&gt;Extension methods are brought into scope at the namespace level. For example, if&lt;br /&gt;you have multiple static classes that contain extension methods in a single namespace named &lt;span class="code"&gt;Extensions&lt;/span&gt;, they will all be brought into scope by the &lt;span class="code"&gt;using Extensions;&lt;/span&gt; directive.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Implementers of class libraries should not use extension methods to avoid&lt;br /&gt;creating new versions of assemblies. If you want to add significant new&lt;br /&gt;functionality to a library, and you own the source code, you should follow the&lt;br /&gt;standard .NET Framework guidelines for assembly versioning&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-8848808303274397947?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/8848808303274397947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=8848808303274397947' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8848808303274397947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/8848808303274397947'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/02/extension-method.html' title='Extension method'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-3035484533981741969</id><published>2008-02-09T19:26:00.000+05:30</published><updated>2008-02-09T19:37:41.099+05:30</updated><title type='text'>Standard Query Operators for LINQ</title><content type='html'>&lt;table border="1"&gt; &lt;tr&gt; &lt;td&gt;Where &lt;/td&gt; &lt;td&gt; Restriction operator based on predicate function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Select/SelectMany &lt;/td&gt; &lt;td&gt; Projection operators based on selector function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Take/Skip/ TakeWhile/SkipWhile &lt;/td&gt; &lt;td&gt; Partitioning operators based on position or predicate function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Join/GroupJoin &lt;/td&gt; &lt;td&gt; Join operators based on key selector functions &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Concat &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;tr&gt; &lt;td&gt;OrderBy/ThenBy/ OrderByDescending/ ThenByDescending &lt;/td&gt; &lt;td&gt;  Sorting operators sorting in ascending or descending order based on optional key selector and comparer functions &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Reverse &lt;/td&gt; &lt;td&gt; Sorting operator reversing the order of a sequence &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;GroupBy &lt;/td&gt; &lt;td&gt; Grouping operator based on optional key selector and comparer functions &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Distinct  &lt;/td&gt; &lt;td&gt; Set operator removing duplicates &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;  Union/Intersect &lt;/td&gt; &lt;td&gt; Set operators returning set union or intersection &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Except &lt;/td&gt; &lt;td&gt;Set operator returning set difference &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;AsEnumerable &lt;/td&gt; &lt;td&gt; Conversion operator to IEnumerable&amp;lt;T&amp;gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ToArray/ToList &lt;/td&gt; &lt;td&gt;Conversion operator to array or List&amp;lt;T&amp;gt; &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ToDictionary/ToLookup &lt;/td&gt; &lt;td&gt;Conversion operators to&lt;span style="font-size:0;"&gt; &lt;/span&gt; &lt;span style="font-size:0;"&gt;Dictionary&amp;lt;K,T&amp;gt;&lt;/span&gt; or &lt;span style="font-size:0;"&gt;Lookup&amp;lt;K,T&amp;gt;&lt;/span&gt; (multi-dictionary) based on key selector function&lt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;OfType/Cast &lt;/td&gt; &lt;td&gt; Conversion operators to IEnumerable&amp;lt;T&amp;gt; based on filtering by or conversion to type argument &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; SequenceEqual &lt;/td&gt; &lt;td&gt;Equality operator checking pairwise element equality &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;  First/FirstOrDefault/  Last/LastOrDefault/ Single/SingleOrDefault &lt;/td&gt; &lt;td&gt; Element operators returning initial/final/only element based on optional predicate function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ElementAt/  ElementAtOrDefault &lt;/td&gt; &lt;td&gt; Element operators returning element based on position &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; DefaultIfEmpty &lt;/td&gt; &lt;td&gt;  Element operator replacing empty sequence with default-valued singleton sequence &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Range &lt;/td&gt; &lt;td&gt; Generation operator returning numbers in a range &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Repeat &lt;/td&gt; &lt;td&gt; Generation operator returning multiple occurrences of a given value &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Empty &lt;/td&gt; &lt;td&gt; Generation operator returning an empty sequence &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Any/All &lt;/td&gt; &lt;td&gt; Quantifier checking for existential or universal satisfaction of predicate function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Contains &lt;/td&gt; &lt;td&gt; Quantifier checking for presence of a given element &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Count/LongCount &lt;/td&gt; &lt;td&gt; Aggregate operators counting elements based on optional predicate function &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Sum/Min/Max/Average &lt;/td&gt; &lt;td&gt; Aggregate operators based on optional selector functions &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Aggregate &lt;/td&gt;&lt;td&gt; Aggregate operator accumulating multiple values based on accumulation function and optional seed &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-3035484533981741969?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/3035484533981741969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=3035484533981741969' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/3035484533981741969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/3035484533981741969'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/02/where-restriction-operator-based-on.html' title='Standard Query Operators for LINQ'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-6780418505314752518</id><published>2008-02-05T20:53:00.000+05:30</published><updated>2008-02-05T20:58:38.970+05:30</updated><title type='text'>New Things in VS 2008</title><content type='html'>1. LINQ Support&lt;br /&gt;&lt;br /&gt;2. Expression Blend Support&lt;br /&gt;&lt;br /&gt;3. Windows Presentation Foundation&lt;br /&gt;&lt;br /&gt;4. VS 2008 Multi-Targeting Support&lt;br /&gt;&lt;br /&gt;5. AJAX support for ASP.NET&lt;br /&gt;&lt;br /&gt;6. JavaScript Debugging Support&lt;br /&gt;&lt;br /&gt;7. Nested Master Page Support&lt;br /&gt;&lt;br /&gt;8. LINQ Intellisense and Javascript Intellisense support for silverlight applications&lt;br /&gt;&lt;br /&gt;9. Organize Imports or Usings&lt;br /&gt;&lt;br /&gt;10. Intellisense Filtering&lt;br /&gt;&lt;br /&gt;11. Intellisense Box display position&lt;br /&gt;&lt;br /&gt;12. Visual Studio 2008 Split View&lt;br /&gt;&lt;br /&gt;13. HTML JavaScript warnings, not as errors&lt;br /&gt;&lt;br /&gt;14. Debugging .NET Framework Library Source Code&lt;br /&gt;&lt;br /&gt;15. In built Silverlight Library&lt;br /&gt;&lt;br /&gt;16. Visual Studio LINQ Designer&lt;br /&gt;&lt;br /&gt;17. Inbuilt C++ SDK&lt;br /&gt;&lt;br /&gt;18. Multilingual User Interface Architecture - MUI&lt;br /&gt;&lt;br /&gt;19. Microsoft Popfly Support&lt;br /&gt;&lt;br /&gt;20. Free Tools and Resources&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!-- google_ad_client = "pub-2185283601569925"; /* 468x60, created 2/5/08 */ google_ad_slot = "1799478145"; google_ad_width = 468; google_ad_height = 60; //--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;br /&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-6780418505314752518?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/6780418505314752518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=6780418505314752518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6780418505314752518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/6780418505314752518'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/02/new-things-in-vs-2008.html' title='New Things in VS 2008'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-2181849060110973023</id><published>2008-02-03T20:09:00.000+05:30</published><updated>2008-02-03T20:20:36.176+05:30</updated><title type='text'>Lambda Expressions</title><content type='html'>A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.&lt;br /&gt;&lt;br /&gt;All lambda expressions use the lambda operator =&gt;, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x =&gt; x * x is read "x goes to x times x." This expression can be assigned to a delegate type as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;delegate int del(int i);&lt;br /&gt;del myDelegate = x =&gt; x * x;&lt;br /&gt;int j = myDelegate(5); //j = 25&lt;br /&gt;To create an expression tree type:&lt;br /&gt;&lt;br /&gt;using System.Linq.Expressions;&lt;br /&gt;// ...&lt;br /&gt;Expression&lt;delegate&gt; = x =&gt; x * x;&lt;br /&gt;The =&gt; operator has the same precedence as assignment (=) and is right-associative.&lt;br /&gt;&lt;br /&gt;Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where and Where(IQueryable, String, array&lt;&gt;[]()[]).&lt;br /&gt;&lt;br /&gt;When you use method-based syntax to call the Where method in the Enumerable class (as you do in LINQ to Objects and LINQ to XML) the parameter is a delegate type System..::.Func&lt;(Of &lt;(T, TResult&gt;)&gt;). A lambda expression is the most convenient way to create that delegate. When you call the same method in, for example, the System.Linq..::.Queryable class (as you do in LINQ to SQL) then the parameter type is an System.Linq.Expressions..::.Expression&lt;func&gt; where Func is any Func delegates with up to five input parameters. Again, a lambda expression is just a very concise way to construct that expression tree. The lambdas allow the Where calls to look similar although in fact the type of object created from the lambda is different.&lt;br /&gt;&lt;br /&gt;In the previous example, notice that the delegate signature has one implicitly-typed input parameter of type int, and returns an int. The lambda expression can be converted to a delegate of that type because it also has one input parameter (x) and a return value that the compiler can implicitly convert to type int. (Type inference is discussed in more detail in the following sections.) When the delegate is invoked by using an input parameter of 5, it returns a result of 25.&lt;br /&gt;&lt;br /&gt;Lambdas are not allowed on the left side of the is or as operator.&lt;br /&gt;&lt;br /&gt;All restrictions that apply to anonymous methods also apply to lambda expressions. For more information, see Anonymous Methods (C# Programming Guide).&lt;br /&gt;&lt;br /&gt;Expression Lambdas&lt;br /&gt;A lambda expression with an expression on the right side is called an expression lambda. Expression lambdas are used extensively in the construction of Expression Trees. An expression lambda returns the result of the expression and takes the following basic form:&lt;br /&gt;&lt;br /&gt;(input parameters) =&gt; expression&lt;br /&gt;The parentheses are optional only if the lambda has one input parameter; otherwise they are required. Two or more input parameters are separated by commas enclosed in parentheses:&lt;br /&gt;&lt;br /&gt;(x, y) =&gt; x == y&lt;br /&gt;Sometimes it is difficult or impossible for the compiler to infer the input types. When this occurs, you can specify the types explicitly as shown in the following example:&lt;br /&gt;&lt;br /&gt;(int x, string s) =&gt; s.Length &gt; x&lt;br /&gt;Specify zero input parameters with empty parentheses:&lt;br /&gt;&lt;br /&gt;() =&gt; SomeMethod()&lt;br /&gt;Note in the previous example that the body of an expression lambda can consist of a method call. However, if you are creating expression trees that will be consumed in another domain, such as SQL Server, you should not use method calls in lambda expressions. The methods will have no meaning outside the context of the .NET common language runtime.&lt;br /&gt;&lt;br /&gt;A statement lambda resembles an expression lambda except that the statement(s) is enclosed in braces:&lt;br /&gt;&lt;br /&gt;(input parameters) =&gt; {statement;}&lt;br /&gt;The body of a statement lambda can consist of any number of statements; however, in practice there are typically no more than two or three.&lt;br /&gt;&lt;br /&gt;delegate void TestDelegate(string s);&lt;br /&gt;…&lt;br /&gt;TestDelegate myDel = n =&gt; { string s = n + " " + "World"; Console.WriteLine(s); };&lt;br /&gt;myDel("Hello");&lt;br /&gt;Statement lambdas, like anonymous methods, cannot be used to create expression trees.&lt;br /&gt;&lt;br /&gt;Lambdas with the Standard Query Operators&lt;br /&gt;Many Standard query operators have an input parameter whose type is one of the Func&lt;(Of &lt;(T, TResult&gt;)&gt;) family of generic delegates. The Func&lt;(Of &lt;(T, TResult&gt;)&gt;) delegates use type parameters to define the number and type of input parameters, and the return type of the delegate. Func delegates are very useful for encapsulating user-defined expressions that are applied to each element in a set of source data. For example, consider the following delegate type:&lt;br /&gt;&lt;br /&gt;public delegate TResult Func&lt;targ0,&gt;(TArg0 arg0)&lt;br /&gt;The delegate can be instantiated as Func&lt;int,bool&gt; myFunc where int is an input parameter and bool is the return value. The return value is always specified in the last type parameter. Func&lt;int,&gt; defines a delegate with two input parameters, int and string, and a return type of bool. The following Func delegate, when it is invoked, will return true or false to indicate whether the input parameter is equal to 5:&lt;br /&gt;&lt;br /&gt;Func&lt;int,&gt; myFunc = x =&gt; x == 5;&lt;br /&gt;bool result = myFunc(4); // returns false of course&lt;br /&gt;You can also supply a lambda expression when the argument type is an Expression&lt;func&gt;, for example in the standard query operators that are defined in System.Linq.Queryable. When you specify an Expression&lt;func&gt; argument, the lambda will be compiled to an expression tree.&lt;br /&gt;&lt;br /&gt;A standard query operator, the Count method, is shown here:&lt;br /&gt;&lt;br /&gt;int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };&lt;br /&gt;int oddNumbers = numbers.Count(n =&gt; n % 2 == 1);&lt;br /&gt;The compiler can infer the type of the input parameter, or you can also specify it explicitly. This particular lambda expression counts those integers (n) which when divided by two have a remainder of 1.&lt;br /&gt;&lt;br /&gt;The following method will produce a sequence that contains all the elements in the numbers array that occur before the “9” because that is the first number in the sequence that does not meet the condition:&lt;br /&gt;&lt;br /&gt;var firstNumbersLessThan6 = numbers.TakeWhile(n =&gt; n &lt;&gt;) with the greater than or equal operator (&gt;=).&lt;br /&gt;&lt;br /&gt;var firstSmallNumbers = numbers.TakeWhile((n, index) =&gt; n &gt;= index);&lt;br /&gt;Type Inference in Lambdas&lt;br /&gt;When writing lambdas, you often do not have to specify a type for the input parameters because the compiler can infer the type based on the lambda body, the underlying delegate type, and other factors as described in the C# 3.0 Language Specification. For most of the standard query operators, the first input is the type of the elements in the source sequence. So if you are querying an IEnumerable&lt;customer&gt;, then the input variable is inferred to be a Customer object, which means you have access to its methods and properties:&lt;br /&gt;&lt;br /&gt;customers.Where(c =&gt; c.City == "London");&lt;br /&gt;The general rules for lambdas are as follows:&lt;br /&gt;&lt;br /&gt;The lambda must contain the same number of parameters as the delegate type.&lt;br /&gt;&lt;br /&gt;Each input parameter in the lambda must be implicitly convertible to its corresponding delegate parameter.&lt;br /&gt;&lt;br /&gt;The return value of the lambda (if any) must be implicitly convertible to the delegate's return type.&lt;br /&gt;&lt;br /&gt;Note that lambda expressions in themselves do not have a type because the common type system has no intrinsic concept of "lambda expression." However, it is sometimes convenient to speak informally of the "type" of a lambda expression. In these cases the type refers to the delegate type or Expression type to which the lambda expression is converted.&lt;br /&gt;&lt;br /&gt;Variable Scope in Lambda Expressions&lt;br /&gt;Lambdas can refer to outer variables that are in scope in the enclosing method or type in which the lambda is defined. Variables that are captured in this manner are stored for use in the lambda expression even if variables would otherwise go out of scope and be garbage collected. An outer variable must be definitely assigned before it can be consumed in a lambda expression. The following example demonstrates these rules:&lt;br /&gt;&lt;br /&gt;delegate bool D();&lt;br /&gt;delegate bool D2(int i);&lt;br /&gt;&lt;br /&gt;class Test&lt;br /&gt;{&lt;br /&gt;D del;&lt;br /&gt;D2 del2;&lt;br /&gt;public void TestMethod(int input)&lt;br /&gt;{&lt;br /&gt;int j = 0;&lt;br /&gt;// Initialize the delegates with lambda expressions.&lt;br /&gt;// Note access to 2 outer variables.&lt;br /&gt;// del will be invoked within this method.&lt;br /&gt;del = () =&gt; { j = 10; return j &gt; input; };&lt;br /&gt;&lt;br /&gt;// del2 will be invoked after TestMethod goes out of scope.&lt;br /&gt;del2 = (x) =&gt; {return x == j; };&lt;br /&gt;&lt;br /&gt;// Demonstrate value of j:&lt;br /&gt;// Output: j = 0&lt;br /&gt;// The delegate has not been invoked yet.&lt;br /&gt;Console.WriteLine("j = {0}", j);&lt;br /&gt;&lt;br /&gt;// Invoke the delegate.&lt;br /&gt;bool boolResult = del();&lt;br /&gt;&lt;br /&gt;// Output: j = 10 b = True&lt;br /&gt;Console.WriteLine("j = {0}. b = {1}", j, boolResult);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;Test test = new Test();&lt;br /&gt;test.TestMethod(5);&lt;br /&gt;&lt;br /&gt;// Prove that del2 still has a copy of&lt;br /&gt;// local variable j from TestMethod.&lt;br /&gt;bool result = test.del2(10);&lt;br /&gt;&lt;br /&gt;// Output: True&lt;br /&gt;Console.WriteLine(result);&lt;br /&gt;&lt;br /&gt;Console.ReadKey();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The following rules apply to variable scope in lambda expressions:&lt;br /&gt;&lt;br /&gt;A variable that is captured will not be garbage-collected until the delegate that references it goes out of scope.&lt;br /&gt;&lt;br /&gt;Variables introduced within a lambda expression are not visible in the outer method.&lt;br /&gt;&lt;br /&gt;A lambda expression cannot directly capture a ref or out parameter from an enclosing method.&lt;br /&gt;&lt;br /&gt;A return statement in a lambda expression does not cause the enclosing method to return.&lt;br /&gt;&lt;br /&gt;A lambda expression cannot contain a goto statement, break statement, or continue statement whose target is outside the body or in the body of a contained anonymous function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3828837637845216808-2181849060110973023?l=net2008-mehul.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://net2008-mehul.blogspot.com/feeds/2181849060110973023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3828837637845216808&amp;postID=2181849060110973023' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/2181849060110973023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3828837637845216808/posts/default/2181849060110973023'/><link rel='alternate' type='text/html' href='http://net2008-mehul.blogspot.com/2008/02/lambda-expressions.html' title='Lambda Expressions'/><author><name>Mehul</name><uri>http://www.blogger.com/profile/10675818520240575114</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05165374643697946972'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3828837637845216808.post-5723574166695465107</id><published>2008-02-03T16:38:00.000+05:30</published><updated>2008-02-03T18:29:40.428+05:30</updated><title type='text'>LINQ an Introduction Part 1</title><content type='html'>&lt;title&gt;Using LINQ with ASP.NET Part 1&lt;br /&gt;&lt;/title&gt;&lt;meta content="ASP.NET, Visual Studio, ASP.NET 3.0, .NET " name="description"&gt;&lt;br /&gt;&lt;meta content="ASP.NET, Visual Studio, ASP.NET 2.0, .NET " name="keywords"&gt;&lt;br /&gt;&lt;br /&gt;&lt;link media="screen" href="/Themes/Blogs/traveler/style/style.css?SectionID=445" type="text/css" rel="stylesheet"&gt;&lt;br /&gt;&lt;link media="print" href="/Themes/Blogs/traveler/style/print.css?SectionID=445" type="text/css" rel="stylesheet"&gt;&lt;br /&gt;&lt;link media="screen" href="/Themes/Blogs/traveler/style/DynamicStyle.aspx?SectionID=445" type="text/css" rel="stylesheet"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script src="/WebResource.axd?d=LEqlBuBvl21zNoZq0noKxOSKP8zu849kSxn2FYOYnlUdRcq8eWoya1E1WQ5yumqYyo1Hsp5-a_BtmKonO9bxbWNHTFoM00vn0&amp;amp;t=633307998080000000" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="/WebResource.axd?d=LEqlBuBvl21zNoZq0noKxOSKP8zu849kSxn2FYOYnlUdRcq8eWoya1E1WQ5yumqYyo1Hsp5-a_DIFOCCG4nctBsV66rmUIqE0&amp;amp;t=633307998080000000" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="/WebResource.axd?d=LEqlBuBvl21zNoZq0noKxOSKP8zu849kSxn2FYOYnlUdRcq8eWoya1E1WQ5yumqYyo1Hsp5-a_Cb_vYW3fLAudjWiTxGtc2IUj7aH-9mkWU1&amp;amp;t=633307998080000000" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="/WebResource.axd?d=LEqlBuBvl21zNoZq0noKxOSKP8zu849kSxn2FYOYnlUdRcq8eWoya1E1WQ5yumqYyo1Hsp5-a_BzGSpsF7brxyTW0Md5BjExk_rQ4oZUkbA1&amp;amp;t=633307998080000000" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="wrapper"&gt;&lt;br /&gt;&lt;div id="container"&gt;&lt;br /&gt;&lt;div id="header"&gt;&lt;br /&gt;&lt;div id="titleWrapper"&gt;&lt;br /&gt;&lt;div id="title"&gt;&lt;br /&gt;&lt;h1&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;One of the new things I’m&lt;br /&gt;super excited about right now is the LINQ family of technologies that are&lt;br /&gt;starting to come out (LINQ, DLINQ, XLINQ and others soon).&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="contentwrapper"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="content"&gt;&lt;div id="content2"&gt;&lt;br /&gt;&lt;div class="post"&gt;&lt;br /&gt;&lt;div class="postsub"&gt;&lt;br /&gt;&lt;div incrementviewcount="true"&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;LINQ will be fully integrated with the next release of Visual Studio (code-name: Orcas) and it will include some very cool framework and tool support (including full intellisense and designer support).&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;I’m going to put together a few blog postings over the next few weeks that show off ways to use LINQ/DLINQ/XLINQ within ASP.NET projects.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This first walkthrough below will help you get started and introduce some of the important LINQ concepts.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="mso-spacerun: yes"&gt;Note: LINQ, DLINQ and XLINQ will be fully supported in both C# and VB.  I am using C# for the example belows.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 0: Creating a C# LINQ ASP.NET Web Site&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;To create a new ASP.NET Web Site that can use LINQ/DLINQ/XLINQ and the new C# 3.0 language features, choose File-&amp;gt;New Web Site in VS and select the “LINQ ASP.NET Web Site Template”:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step1.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;This will create a web-site project with the following files in-it by default:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step2.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that it includes a number of LINQ assemblies in the \bin folder.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It also adds the following setting to the app’s web.config file which tells both VS and ASP.NET to use the C# 3.0 compiler to compile and run the app:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;system.codedom&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;span style="mso-spacerun: yes"&gt;      &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;compilers&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;compiler&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt; &lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:red;"   &gt;language&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;=&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;"&lt;span style="color:blue;"&gt;c#;cs;csharp&lt;/span&gt;"&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="color:red;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="color:red;"&gt;                  extension&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;.cs&lt;/span&gt;"&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="color:blue;"&gt;                  &lt;/span&gt;&lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;"&lt;span style="color:blue;"&gt;Microsoft.CSharp.CSharp3CodeProvider, CSharp3CodeDomProvider&lt;/span&gt;"&lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;span style="mso-spacerun: yes"&gt;      &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;compilers&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;system.codedom&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that the C# 3.0 compiler and CodeDOM provider can run side-by-side with the C# 2.0 versions (so you don’t have to worry about it breaking VS or ASP.NET when you install it).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 1: Creating your first ASP.NET page using LINQ&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Create a new page called Step1.aspx.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Within the .aspx page add a GridView control like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&amp;lt;%&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;@&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:maroon;"&gt;Page&lt;/span&gt; &lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color:red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step1.aspx.cs"&lt;/span&gt; &lt;span style="color:red;"&gt;Inherits&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step1"&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt; &lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;City Names&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="GridView1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Within the code-behind file we’ll then write the canonical “hello world” LINQ sample – which involves searching and ordering a list of strings:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-family:Arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI.WebControls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step1&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] cities = { &lt;span style="color:maroon;"&gt;"&lt;?xml:namespace prefix = st1 /&gt;&lt;st1:city st="on"&gt;London&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Amsterdam&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;San Francisco&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Las Vegas&lt;/st1:place&gt;&lt;/st1:city&gt;"&lt;/span&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                            &lt;/span&gt;&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Boston&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Raleigh&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Chicago&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Charlestown&lt;/st1:place&gt;&lt;/st1:city&gt;"&lt;/span&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                            &lt;/span&gt;&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Helsinki&lt;/st1:city&gt;"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"Nice"&lt;/span&gt;, &lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Dublin&lt;/st1:place&gt;&lt;/st1:city&gt;"&lt;/span&gt; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = from city &lt;span style="color:blue;"&gt;in&lt;/span&gt; cities&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;where city.Length &amp;gt; 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;orderby city &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;select city.ToUpper();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;In the above sample I’ve created an array of strings listing the cities I’ve visited from Jan-&amp;gt;May of this year.&lt;span style="mso-spacerun: yes"&gt;   &lt;/span&gt;I’m then using a LINQ &lt;i style="mso-bidi-font-style: normal"&gt;query expression&lt;/i&gt; against the array.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This query expression returns all cities where the city name is greater than 4 characters, and orders the result in alphabetical order and transforms those city names into upper case.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;LINQ queries return results of type: IEnumerable&amp;lt;T&amp;gt; -- where &amp;lt;T&amp;gt; is determined by the object type of the “select” clause.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In the above sample “city” is a string, so the type-safe result is a generics based collection like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;IEnumerable&amp;lt;string&amp;gt; result = from city &lt;span style="color:blue;"&gt;in&lt;/span&gt; cities&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                              &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;where city.Length &amp;gt; 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                              &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;orderby city &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                              &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;select city.ToUpper();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Because ASP.NET controls already support databinding to any IEnumerable collection, we can easily assign this LINQ query result to the GridView and call its DataBind() method to generate this page output result:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step3.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that instead of using the GridView control I could have just as easily used the &amp;lt;asp:repeater&amp;gt;, &amp;lt;asp:datalist&amp;gt;, &amp;lt;asp:dropdownlist&amp;gt;, or any other ASP.NET list control (both those built-into the product or ones built by other developers).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For the purposes of these samples I’m just going to use the &amp;lt;asp:gridview&amp;gt; -- but again know that you can use any.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step2: Using Richer Collections&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Searching an array of strings is not terribly interesting (although sometimes actually useful).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;More interesting would be the ability to search and work against richer collections of our own making.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The good news is that LINQ makes this easy.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, to better track trips I can create a simple class called “Location” in my project below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:green;"&gt;// Fields&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; _country;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; &lt;span style="mso-tab-count: 1"&gt;  &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;_distance;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; _city;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:green;"&gt;// Properties&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; Country&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;       &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; _country; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt; { _country = &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;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; Distance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; _distance; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt; { _distance = &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;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; City&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt; { &lt;span style="color:blue;"&gt;return&lt;/span&gt; _city; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt; { _city = &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;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;This exposes 3 public properties to track the County, City name and Distance from &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Seattle&lt;/st1:place&gt;&lt;/st1:city&gt;.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I can then create a Step2.aspx file with a GridView control that defines 3 columns like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&amp;lt;%&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;@&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:maroon;"&gt;Page&lt;/span&gt; &lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color:red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step2.aspx.cs"&lt;/span&gt; &lt;span style="color:red;"&gt;Inherits&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step2"&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt; &lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="color:blue;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Cities and their Distances&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="GridView1"&lt;/span&gt; &lt;span style="color:red;"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color:blue;"&gt;="false"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;       &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;Columns&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;      &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BoundField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="Country"&lt;/span&gt; &lt;span style="color:red;"&gt;DataField&lt;/span&gt;&lt;span style="color:blue;"&gt;="Country"&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;          &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BoundField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="City"&lt;/span&gt; &lt;span style="color:red;"&gt;DataField&lt;/span&gt;&lt;span style="color:blue;"&gt;="City"&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;          &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BoundField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="Distance from &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Seattle&lt;/st1:place&gt;&lt;/st1:city&gt;"&lt;/span&gt; &lt;span style="color:red;"&gt;DataField&lt;/span&gt;&lt;span style="color:blue;"&gt;="Distance"&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;       &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;Columns&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;I can then populate a collection of Location objects and databind it to the Grid in my code-behind like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step2&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt;&amp;gt; cities = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt;&amp;gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;London&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4789, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;UK&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Amsterdam&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4869, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Netherlands&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;San Francisco&lt;/st1:city&gt;"&lt;/span&gt;, Distance=684, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                              &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;      &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Las Vegas&lt;/st1:city&gt;"&lt;/span&gt;, Distance=872, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Boston&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2488, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Raleigh&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2363, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Chicago&lt;/st1:city&gt;"&lt;/span&gt;, Distance=1733, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Charleston&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2421, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Helsinki&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4771, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Finland&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"Nice"&lt;/span&gt;, Distance=5428, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;France&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Dublin&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4527, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Ireland&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; cities&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;where location.Distance &amp;gt; 1000&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;orderby location.Country, location.City &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                  &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;             &lt;/span&gt;select location;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The above code-behind shows off a few cool features.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The first is the new C# 3.0 support for creating class instances, and then using a terser syntax for setting properties on them:&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;new&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;London&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4789, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;UK&lt;/st1:place&gt;&lt;/st1:country-region&gt;" }&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;This is very useful when instantiating and adding classes within a collection like above (or within an anonymous type like we’ll see later).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Note that rather than use an array this time, I am using a Generics based List collection of type “Location”.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;LINQ supports executing queries against &lt;i style="mso-bidi-font-style: normal"&gt;any IEnumerable&amp;lt;T&amp;gt; collection&lt;/i&gt;, so can be used against any Generics or non-Generics based object collections you already have.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;For my LINQ query I’m then returning a collection of all cities that are more than 1000 miles away from &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;Seattle&lt;/st1:place&gt;&lt;/st1:city&gt;.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I’ve chosen to order the result in alphabetical order – first by country and then by city name.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The result of this LINQ query is again dictated by the type of the “location” variable – so in this case of type “Location”:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;IEumerable&amp;lt;Location&amp;gt; result = from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; cities&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;     &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;where location.Distance &amp;gt; 1000&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;     &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;orderby location.Country, location.City &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;     &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;select location;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;When I databind this result against the GridView I get a result like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step4.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 3: Refactoring the City Collection Slightly&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Since we’ll be re-using this collection of cities in several other samples, I decided to encapsulate my travels in a “TravelOrganizer” class like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;TravelOrganizer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt;&amp;gt; PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &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;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;         &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;   &lt;/span&gt;&lt;span style="color:teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt;&amp;gt; cities = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt;&amp;gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;London&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4789, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;UK&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Amsterdam&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4869, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Netherlands&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;San Francisco&lt;/st1:city&gt;"&lt;/span&gt;, Distance=684, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Las Vegas&lt;/st1:city&gt;"&lt;/span&gt;, Distance=872, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                       &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Boston&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2488, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Raleigh&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2363, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Chicago&lt;/st1:city&gt;"&lt;/span&gt;, Distance=1733, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Charleston&lt;/st1:city&gt;"&lt;/span&gt;, Distance=2421, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Helsinki&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4771, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Finland&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                             &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;           &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"Nice"&lt;/span&gt;, Distance=5428, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;France&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                        &lt;/span&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Location&lt;/span&gt; { City=&lt;span style="color:maroon;"&gt;"&lt;st1:city st="on"&gt;Dublin&lt;/st1:city&gt;"&lt;/span&gt;, Distance=4527, Country=&lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;Ireland&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;/span&gt; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; cities;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;This allows me to then just write the below code in our code-behind to get the same result as before:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step3&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;TravelOrganizer travel = &lt;span style="color:blue;"&gt;new&lt;/span&gt; TravelOrganizer();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;where location.Distance &amp;gt; 1000&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;orderby location.Country, location.City &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;select location;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;What is really cool about LINQ is that it is strongly-typed.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;What this means is that:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;1) You get compile-time checking of all queries.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Unlike SQL statements today (where you typically only find out at runtime if something is wrong), this means you will be able to check during development that your code is correct (for example: if I wrote “distanse” instead of “distance” above the compiler would catch it for me). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;2) You will get intellisense within VS (and the free Visual Web Developer) when writing LINQ queries.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This makes both typing faster, but also make it much easier to work against both simple and complex collection and datasource object models.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 4: Skipping and Taking using .NET Standard Query Operators&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;LINQ comes with built-in support for many built-in &lt;i style="mso-bidi-font-style: normal"&gt;Standard Query Operators&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;These can be used within code by adding a “using System.Query” statement at the top of a class file, and can be applied to any sequence of data. &lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, if I wanted to list cities in order of distance and list the 2&lt;sup&gt;nd&lt;/sup&gt;-&amp;gt;6&lt;sup&gt;th&lt;/sup&gt; farthest away cities I could write my code-behind file like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step4&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt; travel = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = (from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;orderby location.Distance descending&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;select location).Skip(1).Take(5);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note how I am ordering the result by the distance (farthest to least).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I am then using the “Skip” operator to skip over the first city, and the "Take" operator to only return the remaining 5.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;What is really powerful is that the .NET Standard Query Operators &lt;u&gt;are not&lt;/u&gt; a hard-coded list, and can be added to and replaced by any developer.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This enables very powerful domain specific implementations.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, when the Skip() and Take() operators are used with DLINQ – it translates the calls into back-end SQL logic that performs server-side paging (so that only a few rows are returned from the SQL database – regardless of whether it is from a table with 100,000+ rows of data).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This means that you will be able to trivially build efficient web data paging over lots of relational data (note: until then you can use the techniques listed &lt;/span&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2006/03/22/440900.aspx"&gt;&lt;span style="font-size:85%;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 5: More Fun with .NET Standard Query Operators&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;In addition to returning sequences of data, we can use .NET Standard Query Operators to return single or computed results of data.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The below samples show examples of how to-do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&amp;lt;%&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;@&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:maroon;"&gt;Page&lt;/span&gt; &lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color:red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step5.aspx.cs"&lt;/span&gt; &lt;span style="color:red;"&gt;Inherits&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step5"&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt; &lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Aggregate Value Samples&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Farthest &lt;st1:place st="on"&gt;&lt;st1:placename st="on"&gt;Distance&lt;/st1:placename&gt; &lt;st1:placetype st="on"&gt;City&lt;/st1:placetype&gt;&lt;/st1:place&gt;:&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="MaxCityNameTxt"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;="Label"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="MaxCityDistanceTxt"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;="Label"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Total Travel Distance (outside of US):&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="TotalDistanceTxt"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;="Label"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Average Distance:&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;b&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="AverageDistanceTxt"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;="Label"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step5.aspx.cs code-behind file:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step5&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt; travel = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;// Calculate farthest city away&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:green;"   &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;Location&lt;/span&gt; farthestCity = (from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                 &lt;/span&gt;orderby location.Distance descending&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                 &lt;/span&gt;select location).First();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;MaxCityNameTxt.Text = farthestCity.City;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;MaxCityDistanceTxt.Text = &lt;span style="color:maroon;"&gt;"("&lt;/span&gt; + farthestCity.Distance + &lt;span style="color:maroon;"&gt;" miles)"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;// Calculate total city distances of all cities outside US&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:green;"   &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;int&lt;/span&gt; totalDistance = (from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                         &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;where location.Country != &lt;span style="color:maroon;"&gt;"&lt;st1:country-region st="on"&gt;&lt;st1:place st="on"&gt;USA&lt;/st1:place&gt;&lt;/st1:country-region&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                             &lt;/span&gt;select location).Sum(loc =&amp;gt; loc.Distance);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;TotalDistanceTxt.Text = totalDistance + &lt;span style="color:maroon;"&gt;" miles"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:green;"&gt;// Calculate average city distances of each city trip&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:green;"   &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;double&lt;/span&gt; averageDistance = travel.PlacesVisited.&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;Average(loc =&amp;gt; loc.Distance);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;AverageDistanceTxt.Text = averageDistance + &lt;span style="color:maroon;"&gt;" miles"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that the last two examples above use the new &lt;i style="mso-bidi-font-style: normal"&gt;Lambda Expression&lt;/i&gt; support – which enable fragments of code (like delegates) that can operate on top of data to compute a result.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;You can build your own .NET Query Operators that use these (for example: you could build domain specific ones to calculate shipping costs or payroll tax).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Everything is strongly-typed, and will support intellisense and compilation checking support.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The output of the above sample looks like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step6.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 6: Anonymous Types&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;One of the new C# and VB language features that LINQ can take advantage of is support for “Anonymous Types”.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This allows you to easily create and use type structures inline without having to formally declare their object model (instead it can be inferred by the initialization of the data).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This is very useful to “custom shape” data with LINQ queries.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;For example, consider a scenario where you are working against a database or strongly-typed collection that has many properties – but you only really care about a few of them.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Rather than create and work against the full type, it might be useful to only return those properties that you need.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;To see this in action we’ll create a step6.aspx file like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&amp;lt;%&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;@&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:maroon;"&gt;Page&lt;/span&gt; &lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color:red;"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color:blue;"&gt;="true"&lt;/span&gt; &lt;span style="color:red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step6.aspx.cs"&lt;/span&gt; &lt;span style="color:red;"&gt;Inherits&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step6"&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt; &lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Anonymous Type&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="GridView1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;And within our code-behind file we’ll write a LINQ query that uses anonymous types like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step6&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt; travel = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;orderby location.City&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;select &lt;span style="color:blue;"&gt;new&lt;/span&gt; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;City = location.City,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                    &lt;/span&gt;Distance = location.Distance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;           &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that instead of returning a “location” from our select clause like before, I am instead creating a new anonymous type that has two properties – “City” and “Distance”.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The types of these properties are automatically calculated based on the value of their initial assignment (in this case a string and an int), and when databound to the GridView produce an output like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step7.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Step 7: Anonymous Types (again)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The previous sample showed a basic example of using anonymous types to custom-shape the output of a LINQ query.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The below sample provides a richer and more practical scenario.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It transforms our list of cities into a hierarchical result collection – where we group the results around countries using an anonymous type that we define that contains the country name, a sub-collection list of city details, and the sum of the total distance of all cities within the country (computed using a lambda expression like we demonstrated in step5 above):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Step7&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt; travel = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;TravelOrganizer&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataSource = from location &lt;span style="color:blue;"&gt;in&lt;/span&gt; travel.PlacesVisited&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;group location by location.Country into loc&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;select &lt;span style="color:blue;"&gt;new&lt;/span&gt; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                   &lt;/span&gt;Country = loc.Key,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                   &lt;/span&gt;Cities = loc,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                   &lt;/span&gt;TotalDistance = loc.Sum(dist =&amp;gt; dist.Distance)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                               &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;           &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;GridView1.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The GridView on our .aspx page is then defined like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&amp;lt;%&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;@&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:maroon;"&gt;Page&lt;/span&gt; &lt;span style="color:red;"&gt;Language&lt;/span&gt;&lt;span style="color:blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color:red;"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color:blue;"&gt;="true"&lt;/span&gt; &lt;span style="color:red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step7.aspx.cs"&lt;/span&gt; &lt;span style="color:red;"&gt;Inherits&lt;/span&gt;&lt;span style="color:blue;"&gt;="Step7"&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="BACKGROUND: yellow; mso-no-proof: yes; mso-highlight: yellowfont-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt; &lt;span style="color:red;"&gt;id&lt;/span&gt;&lt;span style="color:blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Groupings with Anonymous Classes&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;h1&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="GridView1"&lt;/span&gt; &lt;span style="color:red;"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color:blue;"&gt;="false"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;Columns&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BoundField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="Country"&lt;/span&gt; &lt;span style="color:red;"&gt;DataField&lt;/span&gt;&lt;span style="color:blue;"&gt;="Country"&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;TemplateField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="Cities"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BulletedList&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="BulletedList1"&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="server"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                                          &lt;/span&gt;&lt;span style="color:red;"&gt;DataSource&lt;/span&gt;&lt;span style="color:blue;"&gt;='&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;#Eval("Cities")&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;' &lt;/span&gt;&lt;span style="color:red;"&gt;DataValueField&lt;/span&gt;&lt;span style="color:blue;"&gt;="City"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;TemplateField&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;                &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;BoundField&lt;/span&gt; &lt;span style="color:red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color:blue;"&gt;="Total Distance"&lt;/span&gt; &lt;span style="color:red;"&gt;DataField&lt;/span&gt;&lt;span style="color:blue;"&gt;="TotalDistance"&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;Columns&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;GridView&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;div&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;form&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;body&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;lt;/&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:maroon;"   &gt;html&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Notice how I’ve added a GridView templatefield column for the “Cities” column – and within that I’ve then added an &amp;lt;asp:bulletedlist&amp;gt; control (a new control built-in with ASP.NET 2.0) that databinds its values from the cities property of the hierarchical result we created using our LINQ query above.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This generates output like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://www.scottgu.com/blogposts/linq/step8.png" /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note that all of the databind syntax and hierarchical binding support in the .aspx page above is fully supported in ASP.NET 2.0 today – so you can use this same technique with any existing app you have now.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;What is new (and I think very cool) is the data shaping capabilities provided by anonymous types and LINQ – which makes binding hierarchical data against ASP.NET controls very easy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Next Steps&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;All of my samples above were against in-memory collections.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;They show you how you will be able to use LINQ against any .NET object model (includes all the ones you have already).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;In my next few LINQ-related blog postings I’ll show how you can go even further, and take advantage of the new DLINQ support to use the above techniques against relational databases as well as the new XLINQ support to work against XML files and structures.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;What is great about the LINQ project is that the syntax and concepts are the same across all of its uses – so once you learn how to use LINQ against an array or collection, you also know all the concepts needed to work against a database or even XML file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;For example, if you use DLINQ to generate a Northwinds database mapping of Suppliers and their Products (no code is required to set this up), the below code is all you need to write to obtain and databind a hierarchical database result against a GridView like we did above (note: we are using the same data-shaping technique as our previous sample to only require fetching two columns from the database, and automatically join the products of each supplier as a hierarchical group result):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;using&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; System.Query;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt; &lt;span style="color:blue;"&gt;partial&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:teal;"&gt;Data_Data2&lt;/span&gt; : System.Web.UI.&lt;span style="color:teal;"&gt;Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color:teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="mso-no-proof: yes;font-family:'Lucida Console';font-size:10;"  &gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;{&lt;o:p&gt;