<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>SpotGnome.com - Visual Studio</title>
    <link>http://www.spotgnome.com/</link>
    <description>Spot the web</description>
    <language>en-us</language>
    <copyright>Guy Levin</copyright>
    <lastBuildDate>Mon, 29 Dec 2008 11:30:46 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>guy@commerix.com</managingEditor>
    <webMaster>guy@commerix.com</webMaster>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Validating XML Against XML Schema (XSD)</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963.aspx</guid>
      <link>http://www.spotgnome.com/2008/12/29/ValidatingXMLAgainstXMLSchemaXSD.aspx</link>
      <pubDate>Mon, 29 Dec 2008 11:30:46 GMT</pubDate>
      <description>&lt;p&gt;
XML documents can reference optional documents that specify how the XML documents
should be structured. These optional documents called Documents Type Definitions (DTDs)
and Schemas.
&lt;/p&gt;
There are two kinds of definition for schemas currently: 
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;1. Microsoft XML Schema &lt;/b&gt;
&lt;br&gt;
&lt;blockquote&gt;It uses the extension .xdr (XML-Data Reduced) you can check the attached
files for the this Schema syntax, it is an xml document, but has special elements
and attributes. 
&lt;br&gt;
&lt;/blockquote&gt;&lt;b&gt;2. W3C XML Schema &lt;/b&gt;
&lt;br&gt;
&lt;blockquote&gt;It uses the extension .xsd (XML Schema Definitions) also it is an XML
Document with special elements.&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;The second approach, XSD Schema, has been supported by Microsoft .NET
Framework and is the best approach for .NET developers. Schema files are a special
kind of XML file that define the structure of an XML file via some pre-defined elements
and attributes. 
&lt;p class="MsoNormal"&gt;
Using this Schema file you can validate your XML file to make sure it fits to your
application's needs and validate the inputs in order to prevent any exception in your
code. 
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
The .Net framework gives you all the tools you need so that you can build XSD schemas
and also validate them.
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
First, let's see how can we create a schema using XSD.exe file (It comes with Visual
Studio):
&lt;/p&gt;
&lt;!--Content type: PSDK_8. Transform: everett2mtps.xslt.--&gt;&lt;a name="cpconxmlschemadefinitiontoolxsdexe"&gt;
&lt;!----&gt;&lt;/a&gt; &lt;blockquote&gt;
&lt;p&gt;
The XML Schema Definition tool generates XML schema or common language runtime classes
from XDR, XML, and XSD files, or from classes in a runtime assembly.
&lt;/p&gt;
&lt;p&gt;
The following command generates an XML schema from &lt;code class="ce"&gt;myFile.xml&lt;/code&gt; and
saves it to the specified directory
&lt;/p&gt;
&lt;div class="" id="ctl00_rs1_mainContentContainer_ctl09_"&gt;
&lt;div dir="ltr"&gt;&lt;pre class="libCScode" style="white-space: pre-wrap;" id="ctl00_rs1_mainContentContainer_ctl09" space="preserve"&gt;xsd myFile.xml /outputdir:myOutputDir&lt;/pre&gt;
&lt;p&gt;
Consider that we have the following xml data file &lt;strong&gt;EmployeeList.xml&lt;/strong&gt;:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;EmployeeList&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="1"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee11&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee12&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee13&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="2"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee21&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee22&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee23&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="3"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee31&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee32&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee33&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;Employee34&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Employee&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;Company&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;EmployeeList&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;
Now, execute XSD.exe on the xml data file:
&lt;/p&gt;
&lt;strong&gt;&gt; XSD EmployeeList.xml&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
The result xsd file &lt;strong&gt;EmployeeList.xsd&lt;/strong&gt; will be :
&lt;/p&gt;
&lt;span class="kwrd"&gt;&lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt;?&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:schema&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="EmployeeList"&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;xmlns:xs&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.w3.org/2001/XMLSchema"&lt;/span&gt; &lt;span class="attr"&gt;xmlns:msdata&lt;/span&gt;&lt;span class="kwrd"&gt;="urn:schemas-microsoft-com:xml-msdata"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="EmployeeList"&lt;/span&gt; &lt;span class="attr"&gt;msdata:IsDataSet&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;msdata:UseCurrentLocale&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:choice&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt; &lt;span class="attr"&gt;maxOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;="unbounded"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="Company"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="Employee"&lt;/span&gt; &lt;span class="attr"&gt;nillable&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt; &lt;span class="attr"&gt;maxOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;="unbounded"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:simpleContent&lt;/span&gt; &lt;span class="attr"&gt;msdata:ColumnName&lt;/span&gt;&lt;span class="kwrd"&gt;="Employee_Text"&lt;/span&gt; &lt;span class="attr"&gt;msdata:Ordinal&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:extension&lt;/span&gt; &lt;span class="attr"&gt;base&lt;/span&gt;&lt;span class="kwrd"&gt;="xs:string"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:extension&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:simpleContent&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;xs:attribute&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="ID"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="xs:string"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:choice&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="html"&gt;xs:schema&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;pre class="libCScode" style="white-space: pre-wrap;" id="ctl00_rs1_mainContentContainer_ctl09" space="preserve"&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p class="MsoNormal"&gt;
Second, now that we have our Schema let's see the steps that we need to do in order
to validate against our schema (&lt;span id="intellitTxt"&gt;&lt;a class="pageTitle" id="#Page3"&gt;.NET
2.0):&lt;/a&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoListNumber"&gt;
1.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Read
the XML file content as Stream, TextReader or XmlReader.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
2.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Read
the Schema file content as Stream, TextReader or XmlReader.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
3.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Create
a new instance of XmlSchema object.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
4.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Set
XmlSchema object by calling XmlSchema.Read() method and passing the content of Schema
file 
&lt;br&gt;
and ValidationEventHandler method address to it.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
5.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Create
a new instance of XmlReaderSettings object.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
6.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Set
ValidationType for XmlReaderSettings object to Schema.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
7.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Add
your XmlSchema object to XmlReaderSettings Schemas collection by calling its Schemas.Add()
method.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
8.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Add
your ValidationEventHandler method address to XmlValidationReader's ValidationEventHandler
handler.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
9.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Create
a new instance of XmlReader object and pass your XML file content (as Stream or a
Reader object) 
&lt;br&gt;
and XmlReaderSettings object to it.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
10.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Call
Read() method of the Reader or Stream object to contain your XML file content in a
loop to parse 
&lt;br&gt;
and validate it completely.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
11.&lt;span style="font-family: "times new Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;Add
your logic to ValidationEventHandler method you created to implement what you want
to be done in 
&lt;br&gt;
the validation process.
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p class="MsoListNumber"&gt;
Here is the code to accomplish this:
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;private&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;void&lt;/span&gt; ValidatingProcess(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt; XSDPath, &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt; XMLPath)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;try&lt;/span&gt;
&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
1- Read XML file content&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;this&lt;/span&gt;.Reader &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; XmlTextReader(XMLPath);&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
2- Read Schema file content&lt;/span&gt;
&lt;br&gt;
StreamReader SR &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; StreamReader(XSDPath); 
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
3- Create a new instance of XmlSchema object&lt;/span&gt;
&lt;br&gt;
XmlSchema Schema &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; XmlSchema();&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
4- Set Schema object by calling XmlSchema.Read() method&lt;/span&gt;
&lt;br&gt;
Schema &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; XmlSchema.Read(SR, 
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; ValidationEventHandler(ReaderSettings_ValidationEventHandler)); 
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
5- Create a new instance of XmlReaderSettings object&lt;/span&gt;
&lt;br&gt;
XmlReaderSettings ReaderSettings &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; XmlReaderSettings(); 
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
6- Set ValidationType for XmlReaderSettings object&lt;/span&gt;
&lt;br&gt;
ReaderSettings.ValidationType &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; ValidationType.Schema; 
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
7- Add Schema to XmlReaderSettings Schemas collection&lt;/span&gt;
&lt;br&gt;
ReaderSettings.Schemas.Add(Schema); 
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
8- Add your ValidationEventHandler address to&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
XmlReaderSettings ValidationEventHandler&lt;/span&gt;
&lt;br&gt;
ReaderSettings.ValidationEventHandler += 
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; ValidationEventHandler(ReaderSettings_ValidationEventHandler);&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
9- Create a new instance of XmlReader object&lt;/span&gt;
&lt;br&gt;
XmlReader objXmlReader &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; XmlReader.Create(Reader,
ReaderSettings);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
10- Read XML content in a loop&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;while&lt;/span&gt; (objXmlReader.Read())&lt;br&gt;
{ &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;/*Empty
loop*/&lt;/span&gt;} 
&lt;br&gt;
&lt;br&gt;
}&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//try&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
Handle exceptions if you want&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;catch&lt;/span&gt; (UnauthorizedAccessException
AccessEx)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;throw&lt;/span&gt; AccessEx;&lt;br&gt;
}&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//catch&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;catch&lt;/span&gt; (Exception
Ex)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;throw&lt;/span&gt; Ex;&lt;br&gt;
}&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//catch&lt;/span&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;private&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;void&lt;/span&gt; ReaderSettings_ValidationEventHandler(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;object&lt;/span&gt; sender, 
&lt;br&gt;
ValidationEventArgs args)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;//
11- Implement your logic for each validation iteration&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt; strTemp;&lt;br&gt;
strTemp &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;"Line:
"&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;this&lt;/span&gt;.Reader.LineNumber &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;"
- Position: "&lt;/span&gt; 
&lt;br&gt;
&lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;this&lt;/span&gt;.Reader.LinePosition &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;"
- "&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;+&lt;/span&gt; args.Message; 
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;this&lt;/span&gt;.Results.Add(strTemp);&lt;br&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p class="MsoListNumber"&gt;
&lt;/p&gt;
&lt;/blockquote&gt; &lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,2c8c1df3-3cc2-4d9f-b185-3ff1f3bfe963.aspx</comments>
      <category>.Net</category>
      <category>C#</category>
      <category>Serialization</category>
      <category>Visual Studio</category>
      <category>XML</category>
      <category>XSD</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=460690d4-689e-4c82-b550-7c5223219568</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,460690d4-689e-4c82-b550-7c5223219568.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,460690d4-689e-4c82-b550-7c5223219568.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=460690d4-689e-4c82-b550-7c5223219568</wfw:commentRss>
      <title>Export Complete Database To Excel</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,460690d4-689e-4c82-b550-7c5223219568.aspx</guid>
      <link>http://www.spotgnome.com/2008/03/07/ExportCompleteDatabaseToExcel.aspx</link>
      <pubDate>Fri, 07 Mar 2008 09:42:11 GMT</pubDate>
      <description>&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-ansi-language: EN-US"&gt;This
article explains how you can extract all Tables, including Data, to an Excel file.
Every Table will have it's own worksheet. The code does need an excel application
installed on the server, while it's using Office Interop.&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-ansi-language: EN-US"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;To
get this code to work, you need to add a reference to Excel.dll by using Add Reference
on the project and selecting Microsoft Excel 9.0 (or 10.0)&amp;nbsp;Object Library from
the COM tab on the Add Reference dialog.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-ansi-language: EN-US"&gt;And
then import the following namespace:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;Imports&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: 'Courier New'"&gt; System.Runtime.InteropServices.Marshal&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;Now
add the following class to your project:&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Private&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; create(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; sDatabaseName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; dsTables &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; DataSet
= &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; DataSet&lt;br&gt;
&lt;span style="COLOR: green"&gt;
&lt;br&gt;
'Get all Tables from database&lt;br&gt;
&lt;/span&gt;dsTables = getAllTables(sDatabaseName)&lt;br&gt;
&lt;span style="COLOR: green"&gt;'Create Excel Application, Workbook, and WorkSheets&lt;br&gt;
&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; xlExcel &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; Excel.Application&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; xlBooks &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Excel.Workbooks&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; xlBook &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Excel.Workbook&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; tblSheet &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Excel.Worksheet&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; xlCells &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Excel.Range&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; sFile &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'File
name for the excel file&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;sFile
= Server.MapPath(&lt;span style="COLOR: #a31515"&gt;"~\Sheets\"&lt;/span&gt; &amp;amp; sDatabaseName
&amp;amp; &lt;span style="COLOR: #a31515"&gt;"_data.xls"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;xlExcel.Visible
= &lt;span style="COLOR: blue"&gt;False&lt;/span&gt; : xlExcel.DisplayAlerts = &lt;span style="COLOR: blue"&gt;False&lt;br&gt;
&lt;/span&gt;xlBooks = xlExcel.Workbooks&lt;br&gt;
xlBook = xlBooks.Add&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;For&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; i &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt; =
0 &lt;span style="COLOR: blue"&gt;To&lt;/span&gt; dsTables.Tables.Count - 1&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tblSheet = xlBook.Worksheets.Add&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;tblSheet.Name = dsTables.Tables(i).TableName&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;xlCells = tblSheet.Cells&lt;br&gt;
&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'Fill
all cells with data 
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GenerateExcelFile(dsTables.Tables(i),
xlCells) &lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Next&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Remove
initial excel sheets. Within a try catch because the database 
&lt;br&gt;
'could be empty (a workbook without worksheets is not allowed)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Try&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; SheetCount &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt; =
xlExcel.Sheets.Count&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CType&lt;/span&gt;(xlExcel.Sheets(SheetCount
- 0), Excel.Worksheet).Delete()&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CType&lt;/span&gt;(xlExcel.Sheets(SheetCount
- 1), Excel.Worksheet).Delete()&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CType&lt;/span&gt;(xlExcel.Sheets(SheetCount
- 2), Excel.Worksheet).Delete()&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Catch&lt;/span&gt; ex &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Exception&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;End&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;span style="COLOR: blue"&gt;Try&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Save
the excel file&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;xlBook.SaveAs(sFile)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Make
sure all objects are disposed&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;xlBook.Close()&lt;br&gt;
xlExcel.Quit()&lt;br&gt;
ReleaseComObject(xlCells)&lt;br&gt;
ReleaseComObject(tblSheet)&lt;br&gt;
ReleaseComObject(xlBook)&lt;br&gt;
ReleaseComObject(xlBooks)&lt;br&gt;
ReleaseComObject(xlExcel)&lt;br&gt;
xlExcel = &lt;span style="COLOR: blue"&gt;Nothing&lt;br&gt;
&lt;/span&gt;xlBooks = &lt;span style="COLOR: blue"&gt;Nothing&lt;br&gt;
&lt;/span&gt;xlBook = &lt;span style="COLOR: blue"&gt;Nothing&lt;br&gt;
&lt;/span&gt;tblSheet = &lt;span style="COLOR: blue"&gt;Nothing&lt;br&gt;
&lt;/span&gt;xlCells = &lt;span style="COLOR: blue"&gt;Nothing&lt;br&gt;
&lt;/span&gt;&lt;span style="COLOR: green"&gt;'Let the Garbage Collector know it can get to work&lt;br&gt;
&lt;/span&gt;GC.Collect()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Export
Excel for download&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Try&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;HttpContext.Current.Response.ContentType
= &lt;span style="COLOR: #a31515"&gt;"application/octet-stream"&lt;br&gt;
&lt;/span&gt;HttpContext.Current.Response.AddHeader(&lt;span style="COLOR: #a31515"&gt;"Content-Disposition"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"attachment;
filename="&lt;/span&gt; + System.IO.Path.GetFileName(sFile))&lt;br&gt;
HttpContext.Current.Response.Clear()&lt;br&gt;
HttpContext.Current.Response.WriteFile(sFile)&lt;br&gt;
HttpContext.Current.Response.End()&lt;br&gt;
&lt;span style="COLOR: blue"&gt;Catch&lt;/span&gt; ex &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Exception&lt;br&gt;
&lt;span style="COLOR: green"&gt;'An exception will be thrown, but can just be ignored&lt;br&gt;
&lt;/span&gt;&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Try&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;End&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;To
generate the individual sheets, the following Sub is used:&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Private&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Sub&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; GenerateExcelFile(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;ByRef&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; table &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataTable, &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;ByVal&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; xlCells &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; Excel.Range)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; dr &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataRow,
ary() &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Object&lt;br&gt;
Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; iRow &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Integer&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;,
iCol &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Integer&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Output
Column Headers&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;For&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; iCol
= 0 &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;To&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; table.Columns.Count
- 1&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;xlCells(1, iCol + 1) = table.Columns(iCol).ToString&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;xlCells(1).EntireRow.Font.Bold
= &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;True&lt;br&gt;
Next&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Output
Data&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;For&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; iRow
= 0 &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;To&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; table.Rows.Count
- 1&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dr = table.Rows.Item(iRow)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ary = dr.ItemArray&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;For&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; iCol
= 0 &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;To&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; UBound(ary)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;xlCells(iRow
+ 2, iCol + 1) = ary(iCol).ToString&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Response.Write(ary(iCol).ToString
&amp;amp; vbTab)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next&lt;br&gt;
Next&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;xlCells.Columns.AutoFit()&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;End&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Sub&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;And
now the trick to getting all tables and data from a database:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Public&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; database &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;as
String&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Public&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;ReadOnly&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Property&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; getAllTables(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;ByVal &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;sDB &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As
String&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;) &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Get&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;database
= sDB&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #0033ff; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; m_dshelp &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #0033ff; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet
= &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;New&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;getRequestedAllTables(m_dshelp)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Return&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; m_dshelp&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Get&lt;br&gt;
End&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Property&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Private&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Function&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; getRequestedAllTables(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;ByRef&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; p_dataset &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet) &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Boolean&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Retrieve
all tablenames from the database:&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; sSQL &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;String&lt;br&gt;
Dim&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; dsTables &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet
= &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;New&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; DataSet&lt;br&gt;
sSQL = &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"SELECT
[TableName] = so.name, [RowCount] = MAX(si.rows) "&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &amp;amp;
_&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"FROM
sysobjects so, sysindexes si "&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &amp;amp;
_&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"WHERE
so.xtype = 'U' AND si.id = OBJECT_ID(so.name) AND si.rows &amp;gt; 0 "&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &amp;amp;
_&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"GROUP
BY so.name "&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &amp;amp;
_&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"ORDER
BY 2 DESC"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;getData(sSQL, &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"Tables"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;,
dsTables)&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;'Loop
thrue all tables and do a SELECT *. Then add them to the dataset&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;For&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; i &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Integer&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; =
0 &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;To&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; dsTables.Tables(0).Rows.Count
- 1&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sSQL = &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"SELECT
* FROM "&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &amp;amp;
dsTables.Tables(0).Rows(i).Item(0)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;getData(sSQL, dsTables.Tables(0).Rows(i).Item(0),
p_dataset)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Next&lt;br&gt;
End&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Function&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Private
Function &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;getData&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;(ByVal &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;p_sql&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; As
String, ByVal &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;p_table&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; As
String, ByRef &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;pdataset&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; As
DataSet) As Boolean&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;Dim &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;objDataAdapter&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; As &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;SqlDataAdapter&lt;br&gt;
&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;Dim &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;objcommand&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; As &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;SqlCommand&lt;br&gt;
objcommand&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;=&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; New &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;SqlCommand(p_sql,
getConnection)&lt;br&gt;
objDataAdapter =&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; New &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"&gt;SqlDataAdapter(objcommand)&lt;br&gt;
objDataAdapter.Fill(pdataset, p_table)&lt;br&gt;
&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;End
Function&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;div class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt; 
&lt;hr align=center width="100%" size=2&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Private&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Function&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; getConnection() &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;As&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; SqlConnection&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #0033ff; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;If&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; (ConfigurationManager.AppSettings("&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;SQLPW"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)
&amp;lt;&amp;gt;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;""&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; Then&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;getConnection
=&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; New &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;SqlConnection(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"Server="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
_&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ConfigurationManager.AppSettings("&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;SQLserver"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)
&amp;amp;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;";password="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
_&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ConfigurationManager.AppSettings(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"SQLPW"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)
&amp;amp;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;";
user="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
_&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ConfigurationManager.AppSettings("&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;SQLUser"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)
&amp;amp;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;";database="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
database)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;Else&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;getConnection
=&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; New &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;SqlConnection(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"Data
Source="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
_&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ConfigurationManager.AppSettings(&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;"SQLserver"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)
&amp;amp;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;";Initial
Catalog="&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;amp;
_&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;database
&amp;amp;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt; &lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;";Integrated
Security=True"&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;)&lt;br&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"&gt;End
If&lt;br&gt;
End Function&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=460690d4-689e-4c82-b550-7c5223219568" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,460690d4-689e-4c82-b550-7c5223219568.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=599ed2f8-b1fb-4a41-9ecb-315e48a821b5</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,599ed2f8-b1fb-4a41-9ecb-315e48a821b5.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,599ed2f8-b1fb-4a41-9ecb-315e48a821b5.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=599ed2f8-b1fb-4a41-9ecb-315e48a821b5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Over my course of .NET development, I have compiled a list of essential free tools
for .NET applications. This is not a the alpha or the omega of tools, just a short
list that I feel is essential. 
</p>
        <ol>
          <li>
            <h3>SharpDevelop
</h3>
            <a href="http://www.icsharpcode.net/OpenSource/SD/Download" target="_blank">http://www.icsharpcode.net/OpenSource/SD/Download</a>
            <br />
An open source IDE for .NET. Check out the full <a href="http://community.sharpdevelop.net/blogs/mattward/articles/FeatureTour.aspx" target="_blank">feature
tour</a>.<br /><img class="image image-img_assist_custom" height="360" src="http://dotnet.dzone.com/sites/all/files/images/sharpDevelop.img_assist_custom.png" width="500" /><br /><br /></li>
          <li>
            <h3>Visual Web Developer Express Edition
</h3>
            <a id="sqs9" title="http://www.microsoft.com/express/vwd" href="http://www.microsoft.com/express/vwd" target="_blank">http://www.microsoft.com/express/vwd</a>
            <br />
Stripped down version of Visual Studio that allows you to write .NET web applications.<br /><img class="image image-img_assist_custom" height="429" src="http://dotnet.dzone.com/sites/all/files/images/visualWebDeveloper.img_assist_custom.png" width="500" /><br /><br /></li>
          <li>
            <h3>TortoiseSVN
</h3>
            <a id="maik" title="http://tortoisesvn.net/downloads" href="http://tortoisesvn.net/downloads" target="_blank">http://tortoisesvn.net/downloads</a>
            <br />
There is no better Subversion client for Windows. You need this if you are going to
use VisualSVN with Visual Studio.<br /><img class="image image-img_assist_custom" height="377" src="http://dotnet.dzone.com/sites/all/files/images/tortoiseSVN.img_assist_custom.png" width="499" /><br /><br /></li>
          <li>
            <h3>NAnt
</h3>
            <a id="v7xq" title="http://nant.sourceforge.net" href="http://nant.sourceforge.net/" target="_blank">http://nant.sourceforge.net</a>
            <br />
.NET based automation tool that has many built in tasks but could be extended with
custom code written in any .NET language.<br /><img class="image image-img_assist_custom" height="249" src="http://dotnet.dzone.com/sites/all/files/images/nant.img_assist_custom.png" width="499" /><br /><br /></li>
          <li>
            <h3>Snippet Compiler
</h3>
            <a href="http://www.sliver.com/dotnet/SnippetCompiler">http://www.sliver.com/dotnet/SnippetCompiler</a>
            <br />
Snippet compiler is a small tool to write and execute small chunks of .NET code without
creating a Visual Studio project.<br /><img class="image image-img_assist_custom" height="535" src="http://dotnet.dzone.com/sites/all/files/images/snippetCompiler.img_assist_custom.png" width="500" /><br /><br /></li>
          <li>
            <h3>.NET Reflector
</h3>
            <a id="a:c9" title="http://www.aisto.com/roeder/dotnet" href="http://www.aisto.com/roeder/dotnet" target="_blank">http://www.aisto.com/roeder/dotnet</a>
            <br />
Reflector is the class browser, explorer, analyzer and documentation viewer for .NET.
Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies
in C#, Visual Basic and IL.<br /><img class="image image-img_assist_custom" height="377" src="http://dotnet.dzone.com/sites/all/files/images/netReflector.img_assist_custom.png" width="499" /><br /><br /></li>
          <li>
            <h3>Microsoft SQL Server Management Studio Express
</h3>
            <a id="wr-8" title="http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;displaylang=en" target="_blank">http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;displaylang=en</a>
            <br />
Tool for database administration and development from Microsoft<br /><img class="image image-img_assist_custom" height="377" src="http://dotnet.dzone.com/sites/all/files/images/sqlServerManagementStudio.img_assist_custom.png" width="499" /><br /><br /></li>
          <li>
            <h3>Quest Comparison Suite for SQL Server
</h3>
            <a id="gm:y" title="http://www.quest.com/Comparison-Suite-for-SQL-Server" href="http://www.quest.com/Comparison-Suite-for-SQL-Server" target="_blank">http://www.quest.com/Comparison-Suite-for-SQL-Server</a>
            <br />
Compare and synchronize database schema and data<br /><img class="image image-img_assist_custom" height="375" src="http://dotnet.dzone.com/sites/all/files/images/questComparisonSuiteSQLServer.img_assist_custom.png" width="500" /><br /><br /></li>
          <li>
            <h3>XYPlorer
</h3>
            <a id="r2ti" title="http://www.xyplorer.com" href="http://www.xyplorer.com/" target="_blank">http://www.xyplorer.com</a>
            <br />
Awesome file manager. The older version is completely free.<br /><img class="image image-img_assist_custom" height="377" src="http://dotnet.dzone.com/sites/all/files/images/xyplorer.img_assist_custom.png" width="499" /><br /><br /></li>
          <li>
            <h3>Convert C# to VB.NET
</h3>
            <a id="scga" title="http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx" href="http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx" target="_blank">http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx</a>
            <br />
            <img class="image image-img_assist_custom" height="305" src="http://dotnet.dzone.com/sites/all/files/images/convertCSharpToVB.img_assist_custom.png" width="499" />
          </li>
          <li>
            <h3>NAnt Add-In
</h3>
            <a id="lb3t" title="http://www.netlogics.ch/devcenter/display/NLC/NAntAddin" href="http://www.netlogics.ch/devcenter/display/NLC/NAntAddin" target="_blank">http://www.netlogics.ch/devcenter/display/NLC/NAntAddin</a>
            <br />
Visual Studio add-in for NAnt integration<br /><img class="image image-_original" height="646" src="http://dotnet.dzone.com/sites/all/files/images/nantAddin.png" width="325" /><br /><br /></li>
          <li>
            <h3>NUnit Add-In
</h3>
            <a id="ovlg" title="http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin" href="http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin" target="_blank">http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin</a>
            <br />
Visual Studio add-in for NUnit integration<br /><img class="image image-_original" height="640" src="http://dotnet.dzone.com/sites/all/files/images/nUnitAddin.png" width="434" /></li>
        </ol>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=599ed2f8-b1fb-4a41-9ecb-315e48a821b5" />
      </body>
      <title>12 Essential Free Tools for .NET Developers</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,599ed2f8-b1fb-4a41-9ecb-315e48a821b5.aspx</guid>
      <link>http://www.spotgnome.com/2008/02/28/12EssentialFreeToolsForNETDevelopers.aspx</link>
      <pubDate>Thu, 28 Feb 2008 12:53:42 GMT</pubDate>
      <description>&lt;p&gt;
Over my course of .NET development, I have compiled a list of essential free tools
for .NET applications. This is not a the alpha or the omega of tools, just a short
list that I feel is essential. 
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;h3&gt;SharpDevelop
&lt;/h3&gt;
&lt;a href="http://www.icsharpcode.net/OpenSource/SD/Download" target=_blank&gt;http://www.icsharpcode.net/OpenSource/SD/Download&lt;/a&gt;
&lt;br&gt;
An open source IDE for .NET. Check out the full &lt;a href="http://community.sharpdevelop.net/blogs/mattward/articles/FeatureTour.aspx" target=_blank&gt;feature
tour&lt;/a&gt;.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=360 src="http://dotnet.dzone.com/sites/all/files/images/sharpDevelop.img_assist_custom.png" width=500&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;Visual Web Developer Express Edition
&lt;/h3&gt;
&lt;a id=sqs9 title=http://www.microsoft.com/express/vwd href="http://www.microsoft.com/express/vwd" target=_blank&gt;http://www.microsoft.com/express/vwd&lt;/a&gt;
&lt;br&gt;
Stripped down version of Visual Studio that allows you to write .NET web applications.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=429 src="http://dotnet.dzone.com/sites/all/files/images/visualWebDeveloper.img_assist_custom.png" width=500&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;TortoiseSVN
&lt;/h3&gt;
&lt;a id=maik title=http://tortoisesvn.net/downloads href="http://tortoisesvn.net/downloads" target=_blank&gt;http://tortoisesvn.net/downloads&lt;/a&gt;
&lt;br&gt;
There is no better Subversion client for Windows. You need this if you are going to
use VisualSVN with Visual Studio.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=377 src="http://dotnet.dzone.com/sites/all/files/images/tortoiseSVN.img_assist_custom.png" width=499&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;NAnt
&lt;/h3&gt;
&lt;a id=v7xq title=http://nant.sourceforge.net href="http://nant.sourceforge.net/" target=_blank&gt;http://nant.sourceforge.net&lt;/a&gt;
&lt;br&gt;
.NET based automation tool that has many built in tasks but could be extended with
custom code written in any .NET language.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=249 src="http://dotnet.dzone.com/sites/all/files/images/nant.img_assist_custom.png" width=499&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;Snippet Compiler
&lt;/h3&gt;
&lt;a href="http://www.sliver.com/dotnet/SnippetCompiler"&gt;http://www.sliver.com/dotnet/SnippetCompiler&lt;/a&gt;
&lt;br&gt;
Snippet compiler is a small tool to write and execute small chunks of .NET code without
creating a Visual Studio project.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=535 src="http://dotnet.dzone.com/sites/all/files/images/snippetCompiler.img_assist_custom.png" width=500&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;.NET Reflector
&lt;/h3&gt;
&lt;a id=a:c9 title=http://www.aisto.com/roeder/dotnet href="http://www.aisto.com/roeder/dotnet" target=_blank&gt;http://www.aisto.com/roeder/dotnet&lt;/a&gt;
&lt;br&gt;
Reflector is the class browser, explorer, analyzer and documentation viewer for .NET.
Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies
in C#, Visual Basic and IL.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=377 src="http://dotnet.dzone.com/sites/all/files/images/netReflector.img_assist_custom.png" width=499&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;Microsoft SQL Server Management Studio Express
&lt;/h3&gt;
&lt;a id=wr-8 title=http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;amp;displaylang=en href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;amp;displaylang=en" target=_blank&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&amp;amp;displaylang=en&lt;/a&gt;
&lt;br&gt;
Tool for database administration and development from Microsoft&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=377 src="http://dotnet.dzone.com/sites/all/files/images/sqlServerManagementStudio.img_assist_custom.png" width=499&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;Quest Comparison Suite for SQL Server
&lt;/h3&gt;
&lt;a id=gm:y title=http://www.quest.com/Comparison-Suite-for-SQL-Server href="http://www.quest.com/Comparison-Suite-for-SQL-Server" target=_blank&gt;http://www.quest.com/Comparison-Suite-for-SQL-Server&lt;/a&gt;
&lt;br&gt;
Compare and synchronize database schema and data&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=375 src="http://dotnet.dzone.com/sites/all/files/images/questComparisonSuiteSQLServer.img_assist_custom.png" width=500&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;XYPlorer
&lt;/h3&gt;
&lt;a id=r2ti title=http://www.xyplorer.com href="http://www.xyplorer.com/" target=_blank&gt;http://www.xyplorer.com&lt;/a&gt;
&lt;br&gt;
Awesome file manager. The older version is completely free.&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=377 src="http://dotnet.dzone.com/sites/all/files/images/xyplorer.img_assist_custom.png" width=499&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;Convert C# to VB.NET
&lt;/h3&gt;
&lt;a id=scga title=http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx href="http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx" target=_blank&gt;http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx&lt;/a&gt;
&lt;br&gt;
&lt;img class="image image-img_assist_custom" height=305 src="http://dotnet.dzone.com/sites/all/files/images/convertCSharpToVB.img_assist_custom.png" width=499&gt; 
&lt;li&gt;
&lt;h3&gt;NAnt Add-In
&lt;/h3&gt;
&lt;a id=lb3t title=http://www.netlogics.ch/devcenter/display/NLC/NAntAddin href="http://www.netlogics.ch/devcenter/display/NLC/NAntAddin" target=_blank&gt;http://www.netlogics.ch/devcenter/display/NLC/NAntAddin&lt;/a&gt;
&lt;br&gt;
Visual Studio add-in for NAnt integration&lt;br&gt;
&lt;img class="image image-_original" height=646 src="http://dotnet.dzone.com/sites/all/files/images/nantAddin.png" width=325&gt; 
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;h3&gt;NUnit Add-In
&lt;/h3&gt;
&lt;a id=ovlg title=http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin href="http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin" target=_blank&gt;http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin&lt;/a&gt;
&lt;br&gt;
Visual Studio add-in for NUnit integration&lt;br&gt;
&lt;img class="image image-_original" height=640 src="http://dotnet.dzone.com/sites/all/files/images/nUnitAddin.png" width=434&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=599ed2f8-b1fb-4a41-9ecb-315e48a821b5" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,599ed2f8-b1fb-4a41-9ecb-315e48a821b5.aspx</comments>
      <category>.Net</category>
      <category>Microsoft</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=c672cf17-39dd-4abd-a263-6f0c78537daf</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,c672cf17-39dd-4abd-a263-6f0c78537daf.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,c672cf17-39dd-4abd-a263-6f0c78537daf.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c672cf17-39dd-4abd-a263-6f0c78537daf</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It was all going so smoothly. <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fdevelop.com%2fus%2ftechnology%2fbio.aspx%3fid%3d52"><strong><font color="#355ea0">Jason
Whittington</font></strong></a>, <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fdevelop.com%2fus%2ftechnology%2fbio.aspx%3fid%3d98"><strong><font color="#355ea0">Mark
Smith</font></strong></a> and I were teaching the big <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fwww.develop.com"><strong><font color="#355ea0">DevelopMentor</font></strong></a> event
here in Los Angeles (<a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fwww.develop.com%2fus%2ftraining%2fcourse.aspx%3fid%3d273"><strong><font color="#355ea0">Guerrilla.NET</font></strong></a>)
when my presentation on the <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fmsdn2.microsoft.com%2fen-us%2flibrary%2fsystem.threading.threadpool.aspx"><strong><font color="#355ea0">ThreadPool</font></strong></a> took
a nose dive. It started with a great joke involving Wilson (the volleyball from <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fwww.imdb.com%2ftitle%2ftt0162222%2f"><i><strong><font color="#355ea0">Cast
Away</font></strong></i></a>). 
</p>
        <p>
Wilson and I built an application to compute a multiplication table where each computation
was (artificially) slow. To speed it up we threw it at the thread pool using <font face="Courier New"><b>delegate.BeginInvoke</b></font>.
We figured that the ThreadPool would allocate 25 or so threads and the table would
display quickly. Here's the expected output - pretty much the same thing we've seen
since about .NET 1.0: 
</p>
        <p>
    <img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/Matrix.png" /></p>
        <p>
Each color represents the thread that did that computation. 
</p>
        <p>
For the last 7 years, the behavior has been that as the ThreadPool was overloaded,
it would steadily start up new threads at the rate of one every 500 milliseconds until
it hits its upper limit (typically). Using Performance Monitor (perfmon) we can watch
the thread pool adding threads. It usually looks something like this: 
</p>
        <p>
    <img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/old_perfmon.png" /></p>
        <p>
Much to our surprise we saw completely different behavior. The thread pool added the
first 15 or so threads quickly (as expected) but then stalled. New threads were <i>not</i> created
every 500ms, instead they were added at increasingly long intervals. My demo took
almost <i>twice</i> as long to run as it had the last time I did this demo a few months
ago. 
</p>
        <p>
Jason, Mark, and I took this code, ported it back to .NET 1.1 and ran it side-by-side
with .NET 3.5 and here's what we saw (blue = 3.5, red = 1.1): 
</p>
        <p>
    <img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/perfmon.PNG" /></p>
        <p>
As of .NET 3.5 the upper limit of the ThreadPool was increased: <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fwww.bluebytesoftware.com%2fblog%2f2007%2f03%2f05%2fWhyTheCLR20SP1sThreadpoolDefaultMaxThreadCountWasIncreasedTo250CPU.aspx"><strong><font color="#355ea0">Knew
that</font></strong></a>. 
</p>
        <p>
But, it appears that v3.5 of the CLR changes the policy for adding threads to the
thread pool. Rather than adding threads regularly when under load the thread pool
uses a logarithmic backoff. My colleague Jason Whittington remarked that this behavior
looked similar to the behavior of the thread pool in <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fresearch.microsoft.com%2fsscli"><strong><font color="#355ea0">"Rotor"</font></strong></a> (the
shared-source version of the CLR). We speculated that this backoff algorithm makes
sense given the new 250-thread per CPU maximum - it would take a long time to reach
that if the runtime waits longer and longer to start a new thread. The 250-thread
limits makes it less likely that your application will deadlock the thread pool, and
the exponential backoff algorithm keeps the thread pool from creating too many threads
too quickly. 
</p>
        <p>
Why should you care? Usually you won't, but it could have dramatic impact if you count
on that behavior. For example, in our contrived case, <b>.NET 1.1 ran about twice
as fast as .NET 3.5 ( ! )</b>: 
</p>
        <p>
    <img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/console_trimmed.png" /></p>
        <p>
Here's the program and source code (trimmed down to run in both .NET 1.1 and 3.5). 
</p>
        <p>
    <a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;url=http%3a%2f%2fwww.michaelckennedy.net%2fblog%2fcontent%2fbinary%2fMath.zip"><strong><font color="#355ea0">Math.zip</font></strong></a> (6.38
KB) 
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=c672cf17-39dd-4abd-a263-6f0c78537daf" />
      </body>
      <title>.NET 3.5 Brings Major (Undocumented) Changes to ThreadPool</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,c672cf17-39dd-4abd-a263-6f0c78537daf.aspx</guid>
      <link>http://www.spotgnome.com/2008/02/10/NET35BringsMajorUndocumentedChangesToThreadPool.aspx</link>
      <pubDate>Sun, 10 Feb 2008 15:03:47 GMT</pubDate>
      <description>&lt;p&gt;
It was all going so smoothly. &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fdevelop.com%2fus%2ftechnology%2fbio.aspx%3fid%3d52"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Jason
Whittington&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;, &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fdevelop.com%2fus%2ftechnology%2fbio.aspx%3fid%3d98"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Mark
Smith&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; and I were teaching the big &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fwww.develop.com"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;DevelopMentor&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; event
here in Los Angeles (&lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fwww.develop.com%2fus%2ftraining%2fcourse.aspx%3fid%3d273"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Guerrilla.NET&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;)
when my presentation on the &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fmsdn2.microsoft.com%2fen-us%2flibrary%2fsystem.threading.threadpool.aspx"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;ThreadPool&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; took
a nose dive. It started with a great joke involving Wilson (the volleyball from &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fwww.imdb.com%2ftitle%2ftt0162222%2f"&gt;&lt;i&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Cast
Away&lt;/font&gt;&lt;/strong&gt;&lt;/i&gt;&lt;/a&gt;). 
&lt;/p&gt;
&lt;p&gt;
Wilson and I built an application to compute a multiplication table where each computation
was (artificially) slow. To speed it up we threw it at the thread pool using &lt;font face="Courier New"&gt;&lt;b&gt;delegate.BeginInvoke&lt;/b&gt;&lt;/font&gt;.
We figured that the ThreadPool would allocate 25 or so threads and the table would
display quickly. Here's the expected output - pretty much the same thing we've seen
since about .NET 1.0: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/Matrix.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
Each color represents the thread that did that computation. 
&lt;/p&gt;
&lt;p&gt;
For the last 7 years, the behavior has been that as the ThreadPool was overloaded,
it would steadily start up new threads at the rate of one every 500 milliseconds until
it hits its upper limit (typically). Using Performance Monitor (perfmon) we can watch
the thread pool adding threads. It usually looks something like this: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/old_perfmon.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
Much to our surprise we saw completely different behavior. The thread pool added the
first 15 or so threads quickly (as expected) but then stalled. New threads were &lt;i&gt;not&lt;/i&gt; created
every 500ms, instead they were added at increasingly long intervals. My demo took
almost &lt;i&gt;twice&lt;/i&gt; as long to run as it had the last time I did this demo a few months
ago. 
&lt;/p&gt;
&lt;p&gt;
Jason, Mark, and I took this code, ported it back to .NET 1.1 and ran it side-by-side
with .NET 3.5 and here's what we saw (blue = 3.5, red = 1.1): 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/perfmon.PNG"&gt; 
&lt;/p&gt;
&lt;p&gt;
As of .NET 3.5 the upper limit of the ThreadPool was increased: &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fwww.bluebytesoftware.com%2fblog%2f2007%2f03%2f05%2fWhyTheCLR20SP1sThreadpoolDefaultMaxThreadCountWasIncreasedTo250CPU.aspx"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Knew
that&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
But, it appears that v3.5 of the CLR changes the policy for adding threads to the
thread pool. Rather than adding threads regularly when under load the thread pool
uses a logarithmic backoff. My colleague Jason Whittington remarked that this behavior
looked similar to the behavior of the thread pool in &lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fresearch.microsoft.com%2fsscli"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;"Rotor"&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; (the
shared-source version of the CLR). We speculated that this backoff algorithm makes
sense given the new 250-thread per CPU maximum - it would take a long time to reach
that if the runtime waits longer and longer to start a new thread. The 250-thread
limits makes it less likely that your application will deadlock the thread pool, and
the exponential backoff algorithm keeps the thread pool from creating too many threads
too quickly. 
&lt;/p&gt;
&lt;p&gt;
Why should you care? Usually you won't, but it could have dramatic impact if you count
on that behavior. For example, in our contrived case, &lt;b&gt;.NET 1.1 ran about twice
as fast as .NET 3.5 ( ! )&lt;/b&gt;: 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img style="BORDER-RIGHT: rgb(0,0,0) thin solid; BORDER-TOP: rgb(0,0,0) thin solid; BORDER-LEFT: rgb(0,0,0) thin solid; BORDER-BOTTOM: rgb(0,0,0) thin solid" src="http://www.michaelckennedy.net/blog/content/binary/console_trimmed.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
Here's the program and source code (trimmed down to run in both .NET 1.1 and 3.5). 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.michaelckennedy.net/blog/ct.ashx?id=55a9b21e-ae85-4c24-a0b6-63dff4a6b491&amp;amp;url=http%3a%2f%2fwww.michaelckennedy.net%2fblog%2fcontent%2fbinary%2fMath.zip"&gt;&lt;strong&gt;&lt;font color=#355ea0&gt;Math.zip&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; (6.38
KB) 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=c672cf17-39dd-4abd-a263-6f0c78537daf" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,c672cf17-39dd-4abd-a263-6f0c78537daf.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=6f63986e-d357-4b5f-83e1-23ac986c1e98</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,6f63986e-d357-4b5f-83e1-23ac986c1e98.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,6f63986e-d357-4b5f-83e1-23ac986c1e98.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6f63986e-d357-4b5f-83e1-23ac986c1e98</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm sure everyone's tired of hearing about C# 3.0 features like lambda expressions,
extension methods, anonymous types and so on.  Before you fall in love with the
new features, there are a few oldies-but-goodies that revolve around the "?" character. 
I use a couple of these to stump interviewees who proclaim themselves to be C# experts. 
These question marks can provide a much cleaner, terser syntax for some fairly common
C# usage patterns.
</p>
        <h3>Conditional operator
</h3>
        <p>
This one can be easy to abuse, but it provides a nice terseness to code that has conditional
assignments:
</p>
        <pre class="code">
          <span style="COLOR: blue">if </span>(hoursTraveled &gt; 0) speed
= distanceInMiles / hoursTraveled; <span style="COLOR: blue">else </span>speed = 0; </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
I'm trying to calculate speed, but clearly I don't want to get DivideByZeroException. 
Sometimes these types of assignments can add up, so I like to condense them down with
the <a href="http://msdn2.microsoft.com/en-us/library/aa691313(VS.71).aspx">C# conditional
operator</a>:
</p>
        <pre class="code">speed = hoursTraveled &gt; 0 ? distanceInMiles / hoursTraveled : 0;
</pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
Now the conditional assignment can be written on a single line.
</p>
        <p>
I don't see this feature used very often, so there is a tradeoff in familiarity. 
If the conditional or assignment statements grow too large, it can start to hurt readability,
so just use your best judgement on this one.
</p>
        <h3>Nullable types
</h3>
        <p>
The release of the .NET Framework 2.0 brought along a little struct type that solved
a whole heap of problems.  Value types (<a href="http://msdn2.microsoft.com/en-us/library/ah19swz4.aspx">structs</a>)
can be used to represent types that don't care about referential identity.  For
example, if I have the number 2, and you have the number 2, they're the same number
no matter how many times we create it.
</p>
        <p>
Value types have another interesting aspect, they can never have a null value. 
The details behind this are exciting if you like things Jeffrey Richter style, full
of heap and stack knowledge, but in the end you just need to know that C# structs
can never be null.  This line does not compile:
</p>
        <pre class="code">
          <span style="COLOR: blue">int </span>i = <span style="COLOR: blue">null</span>;</pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
But not every system in the world that deals with "int" recognizes this rule. 
Databases and XML schemas are two examples where "int" values can be null.  To
handle the impedance mismatch of real-world nulls and CLR-land value types, the Nullable&lt;T&gt;
generic value type was introduced.  By declaring a variable to be Nullable&lt;int&gt;,
I can now do this:
</p>
        <pre class="code">
          <span style="COLOR: #2b91af">Nullable</span>&lt;<span style="COLOR: blue">int</span>&gt;
i; i = <span style="COLOR: blue">null</span>; <span style="COLOR: #2b91af">Assert</span>.That(i.HasValue, <span style="COLOR: #2b91af">Is</span>.False);
i = 3; <span style="COLOR: #2b91af">Assert</span>.That(i.HasValue, <span style="COLOR: #2b91af">Is</span>.True); <span style="COLOR: #2b91af">Assert</span>.That(i.Value, <span style="COLOR: #2b91af">Is</span>.EqualTo(3)); <span style="COLOR: #2b91af">Assert</span>.That(i, <span style="COLOR: #2b91af">Is</span>.EqualTo(3)); </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
Note that I have no problems assigning int values to the Nullable&lt;int&gt; type,
as the <a href="http://lostechies.com/blogs/jimmy_bogard/archive/2007/12/03/dealing-with-primitive-obsession.aspx">appropriate
cast operators</a> have been defined.  Declaring a nullable type is fairly ugly
using the full generic notation, so C# has a nice shortcut:
</p>
        <pre class="code">
          <span style="COLOR: blue">int</span>? i; i = <span style="COLOR: blue">null</span>; </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
There's our friend the question mark.  It's telling us "I think this variable
is an int, but I'm not sure?".  This is just another compiler trick C# uses,
just like extension methods.  At compile time, "int?" is replaced with "Nullable&lt;int&gt;",
so it's really just a shorthand way of expressing nullable types.
</p>
        <p>
Before nullable types, I had to use a bunch of dirty tricks to represent nulls in
my entities, usually with magic numbers and values like "Double.NaN" or "DateTime.MinValue". 
Nullable types let me bridge the gap between the nullable and non-nullable worlds.
</p>
        <h3>Null coalescing operator
</h3>
        <p>
This is the one I love to stump the self-proclaimed experts with.  I draw this
on the whiteboard:
</p>
        <p>
??
</p>
        <p>
And ask them, "what does this operator do in C#?"  Usually I get the crickets,
but the special few can tell me about the <a href="http://msdn2.microsoft.com/en-us/library/ms173224.aspx">null
coalescing operator</a>.  The null coalescing operator is very similar to the
conditional operator, but with the conditional built-in.  I find myself doing
this quite a lot with nulls:
</p>
        <pre class="code">
          <span style="COLOR: blue">if </span>(category.Description == <span style="COLOR: blue">null</span>)
output = <span style="COLOR: #a31515">"&lt;Empty&gt;"</span>; <span style="COLOR: blue">else </span>output
= category.Description; </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
I have a value that could potentially be null, in this case the description of a category,
but I need to output that value to a friendly format.  Unfortunately, nulls aren't
always too friendly to end-users.  Let's try the conditional operator to see
how that cleans things up:
</p>
        <pre class="code">output = category.Description != <span style="COLOR: blue">null </span>?
category.Description : <span style="COLOR: #a31515">"&lt;Empty&gt;"</span>; </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
But these conditionals can get ugly, so I can use the "??" operator to provide an
even terser syntax:
</p>
        <pre class="code">output = category.Description ?? <span style="COLOR: #a31515">"&lt;Empty&gt;"</span>; </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
All of these representations are equivalent, but I like the short and sweet syntax
the "??" operator provides.  Someone not familiar with this operator might not
have any clue what the code does, so there is some level of risk involved.
</p>
        <p>
But I generally don't like to let a lack of knowledge with a built-in language feature
deter me from using it, especially if it can provide a much cleaner syntax.
</p>
        <h3>And as always...
</h3>
        <p>
If the syntax and usage these little question marks provide don't provide better readability
(solubility?), then don't put them in.  These features are there to help, not
to satisfy technical fetishes.  As always, keep in mind that your end goal is
better readability and better maintainability, not a checklist of features used.
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=6f63986e-d357-4b5f-83e1-23ac986c1e98" />
      </body>
      <title>Some C# Obscurities</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,6f63986e-d357-4b5f-83e1-23ac986c1e98.aspx</guid>
      <link>http://www.spotgnome.com/2008/02/03/SomeCObscurities.aspx</link>
      <pubDate>Sun, 03 Feb 2008 09:29:34 GMT</pubDate>
      <description>&lt;p&gt;
I'm sure everyone's tired of hearing about C# 3.0 features like lambda expressions,
extension methods, anonymous types and so on.&amp;nbsp; Before you fall in love with the
new features, there are a few oldies-but-goodies that revolve around the "?" character.&amp;nbsp;
I use a couple of these to stump interviewees who proclaim themselves to be C# experts.&amp;nbsp;
These question marks can provide a much cleaner, terser syntax for some fairly common
C# usage patterns.
&lt;/p&gt;
&lt;h3&gt;Conditional operator
&lt;/h3&gt;
&lt;p&gt;
This one can be easy to abuse, but it provides a nice terseness to code that has conditional
assignments:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(hoursTraveled &amp;gt; 0) speed =
distanceInMiles / hoursTraveled; &lt;span style="COLOR: blue"&gt;else &lt;/span&gt;speed = 0; &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
I'm trying to calculate speed, but clearly I don't want to get DivideByZeroException.&amp;nbsp;
Sometimes these types of assignments can add up, so I like to condense them down with
the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa691313(VS.71).aspx"&gt;C# conditional
operator&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class=code&gt;speed = hoursTraveled &amp;gt; 0 ? distanceInMiles / hoursTraveled : 0;
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
Now the conditional assignment can be written on a single line.
&lt;/p&gt;
&lt;p&gt;
I don't see this feature used very often, so there is a tradeoff in familiarity.&amp;nbsp;
If the conditional or assignment statements grow too large, it can start to hurt readability,
so just use your best judgement on this one.
&lt;/p&gt;
&lt;h3&gt;Nullable types
&lt;/h3&gt;
&lt;p&gt;
The release of the .NET Framework 2.0 brought along a little struct type that solved
a whole heap of problems.&amp;nbsp; Value types (&lt;a href="http://msdn2.microsoft.com/en-us/library/ah19swz4.aspx"&gt;structs&lt;/a&gt;)
can be used to represent types that don't care about referential identity.&amp;nbsp; For
example, if I have the number 2, and you have the number 2, they're the same number
no matter how many times we create it.
&lt;/p&gt;
&lt;p&gt;
Value types have another interesting aspect, they can never have a null value.&amp;nbsp;
The details behind this are exciting if you like things Jeffrey Richter style, full
of heap and stack knowledge, but in the end you just need to know that C# structs
can never be null.&amp;nbsp; This line does not compile:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;int &lt;/span&gt;i = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
But not every system in the world that deals with "int" recognizes this rule.&amp;nbsp;
Databases and XML schemas are two examples where "int" values can be null.&amp;nbsp; To
handle the impedance mismatch of real-world nulls and CLR-land value types, the Nullable&amp;lt;T&amp;gt;
generic value type was introduced.&amp;nbsp; By declaring a variable to be Nullable&amp;lt;int&amp;gt;,
I can now do this:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: #2b91af"&gt;Nullable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&amp;gt;
i; i = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;; &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.That(i.HasValue, &lt;span style="COLOR: #2b91af"&gt;Is&lt;/span&gt;.False);
i = 3; &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.That(i.HasValue, &lt;span style="COLOR: #2b91af"&gt;Is&lt;/span&gt;.True); &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.That(i.Value, &lt;span style="COLOR: #2b91af"&gt;Is&lt;/span&gt;.EqualTo(3)); &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.That(i, &lt;span style="COLOR: #2b91af"&gt;Is&lt;/span&gt;.EqualTo(3)); &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
Note that I have no problems assigning int values to the Nullable&amp;lt;int&amp;gt; type,
as the &lt;a href="http://lostechies.com/blogs/jimmy_bogard/archive/2007/12/03/dealing-with-primitive-obsession.aspx"&gt;appropriate
cast operators&lt;/a&gt; have been defined.&amp;nbsp; Declaring a nullable type is fairly ugly
using the full generic notation, so C# has a nice shortcut:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;? i; i = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;; &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
There's our friend the question mark.&amp;nbsp; It's telling us "I think this variable
is an int, but I'm not sure?".&amp;nbsp; This is just another compiler trick C# uses,
just like extension methods.&amp;nbsp; At compile time, "int?" is replaced with "Nullable&amp;lt;int&amp;gt;",
so it's really just a shorthand way of expressing nullable types.
&lt;/p&gt;
&lt;p&gt;
Before nullable types, I had to use a bunch of dirty tricks to represent nulls in
my entities, usually with magic numbers and values like "Double.NaN" or "DateTime.MinValue".&amp;nbsp;
Nullable types let me bridge the gap between the nullable and non-nullable worlds.
&lt;/p&gt;
&lt;h3&gt;Null coalescing operator
&lt;/h3&gt;
&lt;p&gt;
This is the one I love to stump the self-proclaimed experts with.&amp;nbsp; I draw this
on the whiteboard:
&lt;/p&gt;
&lt;p&gt;
??
&lt;/p&gt;
&lt;p&gt;
And ask them, "what does this operator do in C#?"&amp;nbsp; Usually I get the crickets,
but the special few can tell me about the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms173224.aspx"&gt;null
coalescing operator&lt;/a&gt;.&amp;nbsp; The null coalescing operator is very similar to the
conditional operator, but with the conditional built-in.&amp;nbsp; I find myself doing
this quite a lot with nulls:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(category.Description == &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)
output = &lt;span style="COLOR: #a31515"&gt;"&amp;lt;Empty&amp;gt;"&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;else &lt;/span&gt;output
= category.Description; &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
I have a value that could potentially be null, in this case the description of a category,
but I need to output that value to a friendly format.&amp;nbsp; Unfortunately, nulls aren't
always too friendly to end-users.&amp;nbsp; Let's try the conditional operator to see
how that cleans things up:
&lt;/p&gt;
&lt;pre class=code&gt;output = category.Description != &lt;span style="COLOR: blue"&gt;null &lt;/span&gt;?
category.Description : &lt;span style="COLOR: #a31515"&gt;"&amp;lt;Empty&amp;gt;"&lt;/span&gt;; &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
But these conditionals can get ugly, so I can use the "??" operator to provide an
even terser syntax:
&lt;/p&gt;
&lt;pre class=code&gt;output = category.Description ?? &lt;span style="COLOR: #a31515"&gt;"&amp;lt;Empty&amp;gt;"&lt;/span&gt;; &lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
All of these representations are equivalent, but I like the short and sweet syntax
the "??" operator provides.&amp;nbsp; Someone not familiar with this operator might not
have any clue what the code does, so there is some level of risk involved.
&lt;/p&gt;
&lt;p&gt;
But I generally don't like to let a lack of knowledge with a built-in language feature
deter me from using it, especially if it can provide a much cleaner syntax.
&lt;/p&gt;
&lt;h3&gt;And as always...
&lt;/h3&gt;
&lt;p&gt;
If the syntax and usage these little question marks provide don't provide better readability
(solubility?), then don't put them in.&amp;nbsp; These features are there to help, not
to satisfy technical fetishes.&amp;nbsp; As always, keep in mind that your end goal is
better readability and better maintainability, not a checklist of features used.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=6f63986e-d357-4b5f-83e1-23ac986c1e98" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,6f63986e-d357-4b5f-83e1-23ac986c1e98.aspx</comments>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=6eebbe6c-f867-416b-9a47-047959d1bdd7</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,6eebbe6c-f867-416b-9a47-047959d1bdd7.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,6eebbe6c-f867-416b-9a47-047959d1bdd7.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6eebbe6c-f867-416b-9a47-047959d1bdd7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div class="descr">
          <img alt="Prototype 1.6+ cheat sheet" src="http://attic.scripteka.com/cheatsheet_sneakpeak.png" />
        </div>
        <div class="entry">
          <p style="MARGIN-TOP: 40px">
A long awaited <strong>Prototype cheat sheet</strong> - a full reference to a <strong>bleeding
edge 1.6.0.2</strong> is finally <a title="prototype (v1.6.0.2) cheat sheet " href="http://attic.scripteka.com/prototype_cheatsheet_1.6.0.2.pdf">here</a>.
I had no experience creating something like this before, so any bugs or suggestions
are very much appreciated. Couple of notes about notations:
</p>
          <ul>
            <li>
Modules are sorted in a somewhat logical order - those commonly used are mostly in
the left/center area, while deprecated/utility methods are all the way to the right 
</li>
            <li>
Method can be recognized by parentheses following it (anything that doesn’t have ones
is a property) 
</li>
            <li>
Deprecated items are marked red and have NO parentheses/arguments specified 
</li>
            <li>
Prototype extends quite few native objects’ prototypes with a set of convenient methods.
In such cases there’s an explicit note about it next to a module name - i.g. <code>stripScripts()</code> method
from “String (String.prototype)” can be called as <code>'foo'.stripScripts()</code></li>
            <li>
When a module is also a class, there’s a “(constructor)” note next to it - i.g. “Hash
(constructor)” means that it should be called as <code>new Hash()</code></li>
            <li>
There are few bonus items (such as those from Prototype.Browser) which are not yet
included in documentation 
</li>
          </ul>
          <p>
            <a title="prototype (v1.6.0.2) cheat sheet " href="http://attic.scripteka.com/prototype_cheatsheet_1.6.0.2.pdf">Download</a> and
Enjoy!
</p>
          <p>
            <strong>Update:</strong>
          </p>
          <p>
I have managed to choose the most retarded format for the cheat sheet - almost squared
- which was impossible to print or navigate.<br />
Sincere apologies.
</p>
          <p>
There is an updated version at the same address which also fixes few other annoyances:
</p>
          <ul>
            <li>
Ajax.Responders is now a separate section 
</li>
            <li>
Added missing Event.fire 
</li>
            <li>
Added Prototype.BrowserFeatures.XPath 
</li>
            <li>
Added simple “Dimensions/Offsets” diagram 
</li>
            <li>
Minor rearrangements 
</li>
          </ul>
        </div>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=6eebbe6c-f867-416b-9a47-047959d1bdd7" />
      </body>
      <title>Prototype.js Cheat Sheet</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,6eebbe6c-f867-416b-9a47-047959d1bdd7.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/22/PrototypejsCheatSheet.aspx</link>
      <pubDate>Tue, 22 Jan 2008 09:18:20 GMT</pubDate>
      <description>&lt;div class=descr&gt;&lt;img alt="Prototype 1.6+ cheat sheet" src="http://attic.scripteka.com/cheatsheet_sneakpeak.png"&gt;
&lt;/div&gt;
&lt;div class=entry&gt;
&lt;p style="MARGIN-TOP: 40px"&gt;
A long awaited &lt;strong&gt;Prototype cheat sheet&lt;/strong&gt; - a full reference to a &lt;strong&gt;bleeding
edge 1.6.0.2&lt;/strong&gt; is finally &lt;a title="prototype (v1.6.0.2) cheat sheet " href="http://attic.scripteka.com/prototype_cheatsheet_1.6.0.2.pdf"&gt;here&lt;/a&gt;.
I had no experience creating something like this before, so any bugs or suggestions
are very much appreciated. Couple of notes about notations:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Modules are sorted in a somewhat logical order - those commonly used are mostly in
the left/center area, while deprecated/utility methods are all the way to the right 
&lt;li&gt;
Method can be recognized by parentheses following it (anything that doesn’t have ones
is a property) 
&lt;li&gt;
Deprecated items are marked red and have NO parentheses/arguments specified 
&lt;li&gt;
Prototype extends quite few native objects’ prototypes with a set of convenient methods.
In such cases there’s an explicit note about it next to a module name - i.g. &lt;code&gt;stripScripts()&lt;/code&gt; method
from “String (String.prototype)” can be called as &lt;code&gt;'foo'.stripScripts()&lt;/code&gt; 
&lt;li&gt;
When a module is also a class, there’s a “(constructor)” note next to it - i.g. “Hash
(constructor)” means that it should be called as &lt;code&gt;new Hash()&lt;/code&gt; 
&lt;li&gt;
There are few bonus items (such as those from Prototype.Browser) which are not yet
included in documentation 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a title="prototype (v1.6.0.2) cheat sheet " href="http://attic.scripteka.com/prototype_cheatsheet_1.6.0.2.pdf"&gt;Download&lt;/a&gt; and
Enjoy!
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I have managed to choose the most retarded format for the cheat sheet - almost squared
- which was impossible to print or navigate.&lt;br&gt;
Sincere apologies.
&lt;/p&gt;
&lt;p&gt;
There is an updated version at the same address which also fixes few other annoyances:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Ajax.Responders is now a separate section 
&lt;li&gt;
Added missing Event.fire 
&lt;li&gt;
Added Prototype.BrowserFeatures.XPath 
&lt;li&gt;
Added simple “Dimensions/Offsets” diagram 
&lt;li&gt;
Minor rearrangements 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=6eebbe6c-f867-416b-9a47-047959d1bdd7" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,6eebbe6c-f867-416b-9a47-047959d1bdd7.aspx</comments>
      <category>AJAX</category>
      <category>Javascript</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=c4604be4-55ce-425a-977c-bee6026fb79e</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,c4604be4-55ce-425a-977c-bee6026fb79e.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,c4604be4-55ce-425a-977c-bee6026fb79e.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c4604be4-55ce-425a-977c-bee6026fb79e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are like me, you hate hand editing HTML and XML!  But unfortunately, as
a .NET Developer you often find yourself doing it, and if for no other reason, you
have to do it for parts of the Web.Config and Application.Config files. Last night,
I was googling for something, and just found this <a href="http://asphere.aspweb.cz/default.aspx" target="_blank"><font color="#fe0e0d">tool</font></a> from <a href="http://asphere.aspweb.cz/default.aspx" target="_blank"><font color="#fe0e0d">ASPhere</font></a> by
luck. It's really easy, nice, and looks great :)
</p>
        <p align="center">
          <a href="http://asphere.aspweb.cz/default.aspx" target="_blank">
            <img src="http://www.sheltonblog.com/images/FreeUtilityWeb.ConfigEditorwithagreatUI_E4FC/image.png" />
          </a>
        </p>
        <p>
Here you are the URL : <a title="http://asphere.aspweb.cz/default.aspx" href="http://asphere.aspweb.cz/default.aspx"><font color="#fe0e0d">http://asphere.aspweb.cz/default.aspx</font></a></p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=c4604be4-55ce-425a-977c-bee6026fb79e" />
      </body>
      <title>Freeware Tool For Configuration Files (ASP.NET)</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,c4604be4-55ce-425a-977c-bee6026fb79e.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/21/FreewareToolForConfigurationFilesASPNET.aspx</link>
      <pubDate>Mon, 21 Jan 2008 11:42:53 GMT</pubDate>
      <description>&lt;p&gt;
If you are like me, you hate hand editing HTML and XML!&amp;nbsp; But unfortunately, as
a .NET Developer you often find yourself doing it, and if for no other reason, you
have to do it for parts of the Web.Config and Application.Config files. Last night,
I was googling for something, and just found this &lt;a href="http://asphere.aspweb.cz/default.aspx" target=_blank&gt;&lt;font color=#fe0e0d&gt;tool&lt;/font&gt;&lt;/a&gt; from &lt;a href="http://asphere.aspweb.cz/default.aspx" target=_blank&gt;&lt;font color=#fe0e0d&gt;ASPhere&lt;/font&gt;&lt;/a&gt; by
luck. It's really easy, nice, and looks great :)
&lt;/p&gt;
&lt;p align=center&gt;
&lt;a href="http://asphere.aspweb.cz/default.aspx" target=_blank&gt;&lt;img src="http://www.sheltonblog.com/images/FreeUtilityWeb.ConfigEditorwithagreatUI_E4FC/image.png"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Here you are the URL : &lt;a title=http://asphere.aspweb.cz/default.aspx href="http://asphere.aspweb.cz/default.aspx"&gt;&lt;font color=#fe0e0d&gt;http://asphere.aspweb.cz/default.aspx&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=c4604be4-55ce-425a-977c-bee6026fb79e" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,c4604be4-55ce-425a-977c-bee6026fb79e.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=1d4e593b-d002-4f99-87ca-6c54d78846e9</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,1d4e593b-d002-4f99-87ca-6c54d78846e9.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,1d4e593b-d002-4f99-87ca-6c54d78846e9.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1d4e593b-d002-4f99-87ca-6c54d78846e9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Under the category of "you learn something new every day": While watching <a href="http://dnrtv.com/">dnrTV</a> this
morning, I saw something that I've never seen done in C# before.
</p>
        <div class="postcontent">
          <p>
I knew that it was possible to make an "alias" for a namespace in C#. For example,
if you have a complex namespace like MadProps.Windows.Controls (a contrived example)
that you don't want to add to your "using" list, but you don't want to have to retype
every time, you can use code like this to "alias" it:
</p>
          <pre class="code">
            <span style="COLOR: blue">using </span>MPControls = MadProps.Windows.Controls;</pre>
          <p>
That means that instead of typing "MadProps.Windows.Controls.TextBox" all through
your code, you can just type "MPControls.TextBox". Nice.
</p>
          <p>
What I learned this morning, however, is that you can do the same thing with types!
If you have a type name that's really complex (think generic types) you can create
an alias for them, too!
</p>
          <pre class="code">
            <span style="COLOR: blue">using </span>
            <span style="COLOR: #2b91af">MyDict </span>=
System.Collections.Generic.<span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">int</span>, <span style="COLOR: #2b91af">MyLongClassName</span>&gt;;</pre>
          <p>
Now I can just declare a variable as type "MyDict" in code instead of retyping the
full dictionary definition!
</p>
          <p>
Granted the uses are limited. Unless it's a particularly nasty type name I think your
code readability would be best served by avoiding these sorts of aliases. However,
it's great to know that the feature exists.
</p>
        </div>
        <!-- google_ad_section_end -->
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=1d4e593b-d002-4f99-87ca-6c54d78846e9" />
      </body>
      <title>Type Aliases in C#</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,1d4e593b-d002-4f99-87ca-6c54d78846e9.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/17/TypeAliasesInC.aspx</link>
      <pubDate>Thu, 17 Jan 2008 12:03:39 GMT</pubDate>
      <description>&lt;p&gt;
Under the category of "you learn something new every day": While watching &lt;a href="http://dnrtv.com/"&gt;dnrTV&lt;/a&gt; this
morning, I saw something that I've never seen done in C# before.
&lt;/p&gt;
&lt;div class=postcontent&gt;
&lt;p&gt;
I knew that it was possible to make an "alias" for a namespace in C#. For example,
if you have a complex namespace like MadProps.Windows.Controls (a contrived example)
that you don't want to add to your "using" list, but you don't want to have to retype
every time, you can use code like this to "alias" it:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;using &lt;/span&gt;MPControls = MadProps.Windows.Controls;&lt;/pre&gt;
&lt;p&gt;
That means that instead of typing "MadProps.Windows.Controls.TextBox" all through
your code, you can just type "MPControls.TextBox". Nice.
&lt;/p&gt;
&lt;p&gt;
What I learned this morning, however, is that you can do the same thing with types!
If you have a type name that's really complex (think generic types) you can create
an alias for them, too!
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;using &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;MyDict &lt;/span&gt;=
System.Collections.Generic.&lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;MyLongClassName&lt;/span&gt;&amp;gt;;&lt;/pre&gt;
&lt;p&gt;
Now I can just declare a variable as type "MyDict" in code instead of retyping the
full dictionary definition!
&lt;/p&gt;
&lt;p&gt;
Granted the uses are limited. Unless it's a particularly nasty type name I think your
code readability would be best served by avoiding these sorts of aliases. However,
it's great to know that the feature exists.
&lt;/p&gt;
&lt;/div&gt;
&lt;!-- google_ad_section_end --&gt;&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=1d4e593b-d002-4f99-87ca-6c54d78846e9" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,1d4e593b-d002-4f99-87ca-6c54d78846e9.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=460fbb50-e3dd-4dd5-99cd-c4071c0e022c</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,460fbb50-e3dd-4dd5-99cd-c4071c0e022c.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,460fbb50-e3dd-4dd5-99cd-c4071c0e022c.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=460fbb50-e3dd-4dd5-99cd-c4071c0e022c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For a long time I have been looking for a really easy way to create a cryptographically
random string in c#.  I knew it had to be simple but I just had not spend the
time to dig one up.  Specifically I was looking for a quick and easy way to get
a string that was acceptable for use as a Token for session use. 
</p>
        <p>
using System;<br />
using System.Security.Cryptography; 
</p>
        <p>
namespace ConsoleApplication1<br />
{<br />
   class Program<br />
   {<br />
   static void Main(string[] args)<br />
   {<br />
      byte[] random = new Byte[128]; //Tell it how long
you want it to be<br />
      RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();<br />
      rng.GetNonZeroBytes(random); <br />
      // The array is now filled with cryptographically
strong random bytes.
</p>
        <p>
      Console.WriteLine(System.Convert.ToBase64String(random));<br />
         Console.ReadKey();<br />
      }<br />
   }<br />
}
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=460fbb50-e3dd-4dd5-99cd-c4071c0e022c" />
      </body>
      <title>Cryptographicly Random String In C# </title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,460fbb50-e3dd-4dd5-99cd-c4071c0e022c.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/15/CryptographiclyRandomStringInC.aspx</link>
      <pubDate>Tue, 15 Jan 2008 12:56:38 GMT</pubDate>
      <description>&lt;p&gt;
For a long time I have been looking for a really easy way to create a cryptographically
random string in c#.&amp;nbsp; I knew it had to be simple but I just had not spend the
time to dig one up.&amp;nbsp; Specifically I was looking for a quick and easy way to get
a string that was acceptable for use as a Token for session use.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
using System;&lt;br&gt;
using System.Security.Cryptography; 
&lt;/p&gt;
&lt;p&gt;
namespace ConsoleApplication1&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;class Program&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;static void Main(string[] args)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;byte[] random = new Byte[128]; //Tell it how long
you want it to be&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rng.GetNonZeroBytes(random);&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// The array is now filled with cryptographically
strong random bytes.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(System.Convert.ToBase64String(random));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.ReadKey();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=460fbb50-e3dd-4dd5-99cd-c4071c0e022c" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,460fbb50-e3dd-4dd5-99cd-c4071c0e022c.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=f6b8d80e-8f22-4fb9-bb31-65f6818bad80</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,f6b8d80e-8f22-4fb9-bb31-65f6818bad80.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,f6b8d80e-8f22-4fb9-bb31-65f6818bad80.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f6b8d80e-8f22-4fb9-bb31-65f6818bad80</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are looking for a ASP.NET Google Map Control, your search is now over.
</p>
        <p>
Jacob Reimers from <a href="http://www.reimers.dk/">http://www.reimers.dk/</a> offers
a great asp.net control in 2 flavors.
</p>
        <p>
The free version which lets you easily display a map with markers and/or lines and
a licensed version which gives you the full power of Google Maps.
</p>
        <p>
Download the free control, unzip it to your Bin folder in your web app and add a reference
to it.
</p>
        <p>
 
</p>
        <p>
          <strong>This is a sample asp.net page:</strong>
        </p>
        <p>
&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%&gt; 
<br />
&lt;%@ Register Assembly="GoogleMap" Namespace="Reimers.Map" TagPrefix="Reimers" %&gt; 
<br />
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; 
<br />
&lt;head runat="server"&gt; <br />
    &lt;title&gt;Google Map test&lt;/title&gt; 
<br />
&lt;/head&gt; 
<br />
&lt;body&gt; <br />
    &lt;form id="form1" runat="server"&gt; <br />
        &lt;div&gt; <br />
            &lt;reimers:googlemap
id="GMap" runat="server" width="349" height="354" onmarkerclick="GMap_MarkerClick" 
/&gt; <br />
        &lt;/div&gt; <br />
    &lt;/form&gt; 
<br />
  &lt;/body&gt; 
<br />
&lt;/html&gt; 
</p>
        <p>
        </p>
        <p>
          <strong>and the code behind:</strong>
        </p>
        <p>
        </p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white 0% 50%; COLOR: black; FONT-FAMILY: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> System;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> System.Web.UI;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> Reimers.Map;
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">public</span>
            <span style="COLOR: blue">partial</span>
            <span style="COLOR: blue">class</span>
            <span style="COLOR: rgb(43,145,175)">_Default</span> : <span style="COLOR: rgb(43,145,175)">Page</span></p>
          <p style="MARGIN: 0px">
{
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">protected</span><span style="COLOR: blue">void</span> Page_Load(<span style="COLOR: blue">object</span> sender, <span style="COLOR: rgb(43,145,175)">EventArgs</span> e)
</p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        GMap.GoogleKey = <span style="COLOR: rgb(163,21,21)">"Your
API Code here"</span>;
</p>
          <p style="MARGIN: 0px">
        GMap.MapType = <span style="COLOR: rgb(43,145,175)">MapType</span>.Map;
</p>
          <p style="MARGIN: 0px">
        GMap.TypeControl = <span style="COLOR: rgb(43,145,175)">MapTypeControl</span>.None;
</p>
          <p style="MARGIN: 0px">
        GMap.MapControl = <span style="COLOR: rgb(43,145,175)">ControlType</span>.Small;
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: rgb(43,145,175)">GoogleMarker</span> testMarker
= <span style="COLOR: blue">new</span><span style="COLOR: rgb(43,145,175)">GoogleMarker</span>(<span style="COLOR: rgb(163,21,21)">"newMarker"</span>, <span style="COLOR: blue">new</span><span style="COLOR: rgb(43,145,175)">GoogleLatLng</span>(43.611611,
-88.952931));
</p>
          <p style="MARGIN: 0px">
        testMarker.MarkerText = <span style="COLOR: rgb(163,21,21)">"Test
Marker"</span>;
</p>
          <p style="MARGIN: 0px">
        GMap.Markers.Add(testMarker);
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
        GMap.Latitude = testMarker.Latitude;
</p>
          <p style="MARGIN: 0px">
        GMap.Longitude = testMarker.Longitude;
</p>
          <p style="MARGIN: 0px">
        GMap.Zoom = 10;
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">protected</span><span style="COLOR: blue">void</span> GMap_MarkerClick(<span style="COLOR: rgb(43,145,175)">GoogleMap</span> GMap, <span style="COLOR: rgb(43,145,175)">GoogleMarker</span> Marker, <span style="COLOR: blue">ref</span><span style="COLOR: rgb(43,145,175)">String</span> MapCommand)
</p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        MapCommand = Marker.OpenInfoWindowHTML(GMap,
Marker.MarkerText);
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
}
</p>
        </div>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=f6b8d80e-8f22-4fb9-bb31-65f6818bad80" />
      </body>
      <title>ASP.NET Google Map Control</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,f6b8d80e-8f22-4fb9-bb31-65f6818bad80.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/09/ASPNETGoogleMapControl.aspx</link>
      <pubDate>Wed, 09 Jan 2008 11:23:22 GMT</pubDate>
      <description>&lt;p&gt;
If you are looking for a ASP.NET Google Map Control, your search is now over.
&lt;/p&gt;
&lt;p&gt;
Jacob Reimers from &lt;a href="http://www.reimers.dk/"&gt;http://www.reimers.dk/&lt;/a&gt;&amp;nbsp;offers
a great asp.net control in 2 flavors.
&lt;/p&gt;
&lt;p&gt;
The free version which lets you easily display a map with markers and/or lines and
a licensed version which gives you the full power of Google Maps.
&lt;/p&gt;
&lt;p&gt;
Download the free control, unzip it to your Bin folder in your web app and add a reference
to it.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;This is a sample asp.net page:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%&amp;gt; 
&lt;br&gt;
&amp;lt;%@ Register Assembly="GoogleMap" Namespace="Reimers.Map" TagPrefix="Reimers" %&amp;gt; 
&lt;br&gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt; 
&lt;br&gt;
&amp;lt;head runat="server"&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;Google Map test&amp;lt;/title&amp;gt; 
&lt;br&gt;
&amp;lt;/head&amp;gt; 
&lt;br&gt;
&amp;lt;body&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form id="form1" runat="server"&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reimers:googlemap
id="GMap" runat="server" width="349" height="354" onmarkerclick="GMap_MarkerClick"&amp;nbsp;
/&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt; 
&lt;br&gt;
&amp;nbsp; &amp;lt;/body&amp;gt; 
&lt;br&gt;
&amp;lt;/html&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;and the code behind:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white 0% 50%; COLOR: black; FONT-FAMILY: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Web.UI;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; Reimers.Map;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;public&lt;/span&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: rgb(43,145,175)"&gt;_Default&lt;/span&gt; : &lt;span style="COLOR: rgb(43,145,175)"&gt;Page&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &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: rgb(43,145,175)"&gt;EventArgs&lt;/span&gt; e)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.GoogleKey = &lt;span style="COLOR: rgb(163,21,21)"&gt;"Your
API Code here"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.MapType = &lt;span style="COLOR: rgb(43,145,175)"&gt;MapType&lt;/span&gt;.Map;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.TypeControl = &lt;span style="COLOR: rgb(43,145,175)"&gt;MapTypeControl&lt;/span&gt;.None;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.MapControl = &lt;span style="COLOR: rgb(43,145,175)"&gt;ControlType&lt;/span&gt;.Small;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: rgb(43,145,175)"&gt;GoogleMarker&lt;/span&gt; testMarker
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;GoogleMarker&lt;/span&gt;(&lt;span style="COLOR: rgb(163,21,21)"&gt;"newMarker"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;GoogleLatLng&lt;/span&gt;(43.611611,
-88.952931));
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testMarker.MarkerText = &lt;span style="COLOR: rgb(163,21,21)"&gt;"Test
Marker"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.Markers.Add(testMarker);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.Latitude = testMarker.Latitude;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.Longitude = testMarker.Longitude;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GMap.Zoom = 10;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;protected&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; GMap_MarkerClick(&lt;span style="COLOR: rgb(43,145,175)"&gt;GoogleMap&lt;/span&gt; GMap, &lt;span style="COLOR: rgb(43,145,175)"&gt;GoogleMarker&lt;/span&gt; Marker, &lt;span style="COLOR: blue"&gt;ref&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;String&lt;/span&gt; MapCommand)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapCommand = Marker.OpenInfoWindowHTML(GMap,
Marker.MarkerText);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=f6b8d80e-8f22-4fb9-bb31-65f6818bad80" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,f6b8d80e-8f22-4fb9-bb31-65f6818bad80.aspx</comments>
      <category>.Net</category>
      <category>Google</category>
      <category>Programming</category>
      <category>Visual Studio</category>
      <category>Web 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=5fc62032-d7bc-432a-8694-a007f79b1835</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,5fc62032-d7bc-432a-8694-a007f79b1835.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,5fc62032-d7bc-432a-8694-a007f79b1835.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5fc62032-d7bc-432a-8694-a007f79b1835</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sometimes we need to make some write to logs, trace, and maybe limit some features
during debug. It's good to know that in debug mode we have precompiler identifier <strong>DEBUG</strong> is
set. So, first of all you can try <strong>#if #endif</strong> construction. In my
opinion, it's not very good to use <strong>#if</strong> directive, especialy
if there is something better. 
</p>
        <p>
          <strong>Conditional attribute</strong>. It can be applied to any method that returns <strong>void</strong>.
Why void? Because the method call ignored if the condition is not fulfilled. The method
can be static or not. 
</p>
        <pre class="csharpcode">
          <font color="#006400">
            <strong>[Conditional(<span class="str">"DEBUG"</span>)]</strong>
          </font>
          <span class="kwrd">static</span>
          <span class="kwrd">void</span> DebugMethod()
{ } </pre>
        <p>
So, this is the best way to make some job in DEBUG configuration. Also, it can
be used to make different build configurations.
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=5fc62032-d7bc-432a-8694-a007f79b1835" />
      </body>
      <title>Making Custom Actions During Debug</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,5fc62032-d7bc-432a-8694-a007f79b1835.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/09/MakingCustomActionsDuringDebug.aspx</link>
      <pubDate>Wed, 09 Jan 2008 11:18:13 GMT</pubDate>
      <description>&lt;p&gt;
Sometimes we need to make some write to logs, trace, and maybe limit some features
during debug. It's good to know that in debug mode we have precompiler identifier &lt;strong&gt;DEBUG&lt;/strong&gt; is
set. So, first of all you can try &lt;strong&gt;#if #endif&lt;/strong&gt; construction. In my
opinion, it's not very&amp;nbsp;good to use &lt;strong&gt;#if&lt;/strong&gt; directive,&amp;nbsp;especialy
if there is something better. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Conditional attribute&lt;/strong&gt;. It can be applied to any method that returns &lt;strong&gt;void&lt;/strong&gt;.
Why void? Because the method call ignored if the condition is not fulfilled. The method
can be static or not. 
&lt;/p&gt;
&lt;pre class=csharpcode&gt;&lt;font color=#006400&gt;&lt;strong&gt;[Conditional(&lt;span class=str&gt;"DEBUG"&lt;/span&gt;)]&lt;/strong&gt;&lt;/font&gt; &lt;span class=kwrd&gt;static&lt;/span&gt; &lt;span class=kwrd&gt;void&lt;/span&gt; DebugMethod()
{ } &lt;/pre&gt;
&lt;p&gt;
So, this is the best way to make some job in DEBUG configuration.&amp;nbsp;Also, it can
be used to make different build configurations.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=5fc62032-d7bc-432a-8694-a007f79b1835" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,5fc62032-d7bc-432a-8694-a007f79b1835.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=69b9f371-0c95-4c3c-961d-4e63446d60ef</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,69b9f371-0c95-4c3c-961d-4e63446d60ef.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,69b9f371-0c95-4c3c-961d-4e63446d60ef.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=69b9f371-0c95-4c3c-961d-4e63446d60ef</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In 2007 I've worked with <strong>NUnitForms</strong>. It contains all major controls
testers and you can easily create your own ones for e.g. a Data Grid or a 3rd party
control. I had to create one for Janus GridEx and it wasn't really that hard. 
</p>
        <p>
A little reflection went a long way :) Lately, the whole project was at a standstill
for some time but now it seems it's revitalizing nicely with new people on board.
So if you haven't yet go take look. This is just one open source GUI testing platform
and I'm sure there are others... I haven't checked them out though.
</p>
        <p>
          <strong>Now to the big question: Is it worth it?  It depends...</strong>
        </p>
        <p>
I'm not a hardcore TDD practitioner but I like having repeatable unit tests. But having
automated GUI unit tests is in my opinion a waste of time. 
<br /><br />
Why? It simply isn't worth spending time writing them. You should have enough code
coverage with non GUI tests to find any bugs long before hitting the GUI. You might
want to be tempted to unit test control positions or visibility or some other property...
don't bother. 
<br /><br />
You'll spend your time better if you write more non GUI unit tests and check your
GUI by hand (eye).
</p>
        <p>
So what are they useful for? Well... I've used them for acceptance and integration
testing with great success.
</p>
        <p>
          <strong>Integration Tests...</strong>
        </p>
        <p>
... test how different parts of your application work together. These kinds of GUI
tests proved to be VERY useful and they are worth investing time in. They have a great
ROI (return on investment) once they're written. For example we had a large workflow
based application that was completely async in nature. It had a windows forms client
that could be deployed on multiple computers, all those clients connected to
a single server that hosted a few webservices for data modifications, retrieval and
some other stuff. 
</p>
        <p>
The whole app was also connected to Sharepoint server,  Exchange Server, SQL
Server, used InfoPath and a 3rd party software to export data from and into it. With
one single GUI integration test we could easily see if everything worked together
as it should. We mocked the InfoPath and 3rd party software but everything else ran
great. 
</p>
        <p>
The point of using GUI tests here is to see how and if your whole application works
with all parts integrated together from GUI interaction to Exchange connectivity.
Even the best non GUI integration tests simply don't do that. 
</p>
        <p>
          <strong>Acceptance Tests...</strong>
        </p>
        <p>
... test if your software is up to some specs usually defined by the business process.
They're in essence a black box test. You don't care what goes on inside the software
you just want to see if the output is correct for a certain input. In workflow based
processes this can be very useful since you know what the input and output parameters
are for your workflow. 
</p>
        <p>
For example you start the workflow in your app via NUnitForms, pressing "move in workflow"
buttons until the workflow end and then check if the output parameters have the correct
values. You can check for various different GUI parameters in this test along the
way but as I said above don't go overboard. I usually just check for visibility of
certain panels or grids... simple things like that.
</p>
        <p>
When I first started with GUI testing I thought it was a really big waste of time.
And to tell you the truth if you don't draw the line somewhere it is. I even had a
moment when I thought it was a good idea to test everything only with GUI tests. That
was so far over line I couldn't even see it anymore. Luckily that moment passed pretty
fast. Don't make the same mistake. If used wisely automated GUI tests are a big benefit.
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=69b9f371-0c95-4c3c-961d-4e63446d60ef" />
      </body>
      <title>Automated GUI testing - Is it worth it?</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,69b9f371-0c95-4c3c-961d-4e63446d60ef.aspx</guid>
      <link>http://www.spotgnome.com/2008/01/02/AutomatedGUITestingIsItWorthIt.aspx</link>
      <pubDate>Wed, 02 Jan 2008 09:39:05 GMT</pubDate>
      <description>&lt;p&gt;
In 2007 I've worked with &lt;strong&gt;NUnitForms&lt;/strong&gt;. It contains all major controls
testers and you can easily create your own ones for e.g. a Data Grid or a 3rd party
control. I had to create one for Janus GridEx and it wasn't really that hard. 
&lt;/p&gt;
&lt;p&gt;
A little reflection went a long way :) Lately, the whole project was at a standstill
for some time but now it seems it's revitalizing nicely with new people on board.
So if you haven't yet go take look. This is just one open source GUI testing platform
and I'm sure there are others... I haven't checked them out though.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Now to the big question: Is it worth it?&amp;nbsp; It depends...&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I'm not a hardcore TDD practitioner but I like having repeatable unit tests. But having
automated GUI unit tests is in my opinion a waste of time. 
&lt;br&gt;
&lt;br&gt;
Why? It simply isn't worth spending time writing them. You should have enough code
coverage with non GUI tests to find any bugs long before hitting the GUI. You might
want to be tempted to unit test control positions or visibility or some other property...
don't bother. 
&lt;br&gt;
&lt;br&gt;
You'll spend your time better if you write more non GUI unit tests and check your
GUI by hand (eye).
&lt;/p&gt;
&lt;p&gt;
So what are they useful for? Well... I've used them for acceptance and integration
testing with great success.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Integration Tests...&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
... test how different parts of your application work together. These kinds of GUI
tests proved to be VERY useful and they are worth investing time in. They have a great
ROI (return on investment) once they're written. For example we had a large workflow
based application that was completely async in nature. It had a windows forms client
that could be deployed on&amp;nbsp;multiple computers, all those clients connected to
a single server that hosted a few webservices for data modifications, retrieval and
some other stuff. 
&lt;/p&gt;
&lt;p&gt;
The whole app was also connected to Sharepoint server,&amp;nbsp; Exchange Server, SQL
Server, used InfoPath and a 3rd party software to export data from and into it. With
one single GUI integration test we could easily see if everything worked together
as it should. We mocked the InfoPath and 3rd party software but everything else ran
great. 
&lt;/p&gt;
&lt;p&gt;
The point of using GUI tests here is to see how and if your whole application works
with all parts integrated together from GUI interaction to Exchange connectivity.
Even the best non GUI integration tests simply don't do that. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Acceptance Tests...&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
... test if your software is up to some specs usually defined by the business process.
They're in essence a black box test. You don't care what goes on inside the software
you just want to see if the output is correct for a certain input. In workflow based
processes this can be very useful since you know what the input and output parameters
are for your workflow. 
&lt;/p&gt;
&lt;p&gt;
For example you start the workflow in your app via NUnitForms, pressing "move in workflow"
buttons until the workflow end and then check if the output parameters have the correct
values. You can check for various different GUI parameters in this test along the
way but as I said above don't go overboard. I usually just check for visibility of
certain panels or grids... simple things like that.
&lt;/p&gt;
&lt;p&gt;
When I first started with GUI testing I thought it was a really big waste of time.
And to tell you the truth if you don't draw the line somewhere it is. I even had a
moment when I thought it was a good idea to test everything only with GUI tests. That
was so far over line I couldn't even see it anymore. Luckily that moment passed pretty
fast. Don't make the same mistake. If used wisely automated GUI tests are a big benefit.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=69b9f371-0c95-4c3c-961d-4e63446d60ef" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,69b9f371-0c95-4c3c-961d-4e63446d60ef.aspx</comments>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div class="postText">
          <p>
Partial methods are a new feature available in C# 3.0 that don't seem to get enough
credit. I think there was a lot of confusion early on about what partial methods were
and how they were used.
</p>
          <p>
Partial methods are intended to solve a major problem that is not only caused by code-generation
tools and also affects those same tools. For instance, you are writing a code-generation
tool but want to provide a way for the developers that are using your generated classes
to hook in to specific areas of the code. As such, you don't want them editing your
generated code since those customizations will be lost the next time the tool runs.
On the flip side of this scenario is the developer who needs to write the code that
hooks into those specific areas and doesn't want that code being lost the next time
the tool runs.
</p>
          <p>
Delegates are one solution to this type of problem. In the generated code, you declare
a delegate method that you then call at the appropriate areas. If no one has implemented
a concrete version of the delegate, the call will not do anything. However, if someone
has implemented am instance of that delegate then the call will run the code in that
instance. This sounds like a pretty good solution, and, until partial methods it really
was the only solution. The drawback is that the code for the delegate is always compiled
in to the runtime of your application and add to the runtime overhead of application
(granted, that overhead is minimal but it's still there).
</p>
          <p>
Partial classes helped with this problem by allowing the code-generation tools to
isolate the generated code in a partial class. This allowed the developer to add their
own methods to the class without fear that they would be overwritten the next time
the tool ran. However, it only helped partially. In order to accomplish our scenario,
you still needed to provide a delegate to allow the developer to hook into your process.
</p>
          <p>
If we take this a step further and look at partial methods, you will start to see
how they work and what the benefit is of using them. The following rules govern how
partials methods can be declared and used:
</p>
          <ol>
            <li>
Must be declared inside a partial class. 
</li>
            <li>
Must be declared as a <strong>void</strong> return type. 
</li>
            <li>
Must be declared with the <strong>partial</strong>. 
</li>
            <li>
Cannot be marked as <strong>extern</strong>. 
</li>
            <li>
Can be marked <strong>static</strong> or <strong>unsafe</strong>. 
</li>
            <li>
Can be generic. 
</li>
            <li>
Can have <strong>ref</strong> but not <strong>out</strong> parameters. 
</li>
            <li>
Cannot be referenced as a delegate until they are implemented 
</li>
            <li>
Cannot have access modifiers such as <strong>public</strong>, <strong>private</strong> or <strong>internal</strong>. 
</li>
            <li>
Cannot be declared as <strong>virtual</strong>. 
</li>
          </ol>
          <p>
Partial methods are implicitly marked as private. This means they cannot be called
from outside the partial class.
</p>
          <p>
Now that we have the rules out of the way, let's take a look at an example. This is
a completely contrived example, as you typically wouldn't declare both portions of
the partial class yourself.
</p>
          <div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 800px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; HEIGHT: 463px; BACKGROUND-COLOR: #f4f4f4">
            <div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 1:</span>
                <span style="COLOR: #008000">//
This is the class that would normally have been autogenerated.</span>
              </pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 2:</span>
                <span style="COLOR: #0000ff">public</span>
                <span style="COLOR: #0000ff">partial</span>
                <span style="COLOR: #0000ff">class</span> CustomTypedCollection</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 3:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 4:</span>
                <span style="COLOR: #0000ff">partial</span>
                <span style="COLOR: #0000ff">void</span> BeforeAddingElement(CustomElement
element);</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 5:</span>  </pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 6:</span>
                <span style="COLOR: #0000ff">public</span>
                <span style="COLOR: #0000ff">void</span> AddElement(CustomElement
element)</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 7:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 8:</span> BeforeAddingElement();</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 9:</span> }</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 10:</span> }</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 11:</span>  </pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 12:</span>
                <span style="COLOR: #0000ff">public</span>
                <span style="COLOR: #0000ff">partial</span>
                <span style="COLOR: #0000ff">class</span> CustomTypedCollection</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 13:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 14:</span>
                <span style="COLOR: #0000ff">partial</span>
                <span style="COLOR: #0000ff">void</span> BeforeAddingElement(CustomElement
element)</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 15:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 16:</span> Console.WriteLine(<span style="COLOR: #006080">"Element
"</span> + element + <span style="COLOR: #006080">" is being added."</span>);</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 17:</span> }</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 18:</span> }</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 19:</span>  </pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 20:</span>
                <span style="COLOR: #0000ff">class</span> Program</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 21:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 22:</span>
                <span style="COLOR: #0000ff">static</span>
                <span style="COLOR: #0000ff">void</span> Main(<span style="COLOR: #0000ff">string</span>[]
args)</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 23:</span> {</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 24:</span> CustomTypedCollection
c = <span style="COLOR: #0000ff">new</span> CustomTypedCollection();</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 25:</span> c.AddElemeent(<span style="COLOR: #0000ff">new</span> CustomElement());</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 26:</span> }</pre>
              <pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none">
                <span style="COLOR: #606060"> 27:</span> }</pre>
            </div>
          </div>
          <p>
In this example, the code-generation tool declares a partial method BeforeAddingElement.
It is declared as just a function prototype with no implementation. Effectively, this
tells the developer that if they want to hook in to the AddElement process, they can
do so by declaring an implementation of the BeforeAddingElement method. If an implementation
is declared, the implementation and the call inside AddElement will be compiled in
to the runtime code. However, if no implementation is declared the call will be optimized
by the compiler and it will be entirely eliminated in the runtime code.
</p>
          <p>
This mechanism provides a lot of the same flexibility as delegates without the runtime
overhead. It also allows the developer to work with a much smaller implementation
of their portion of the partial class that contains only the few partial methods that
have been implemented.
</p>
        </div>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3" />
      </body>
      <title>C# 3.0 - Partial Methods</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/27/C30PartialMethods.aspx</link>
      <pubDate>Thu, 27 Dec 2007 17:53:47 GMT</pubDate>
      <description>&lt;div class=postText&gt;
&lt;p&gt;
Partial methods are a new feature available in C# 3.0 that don't seem to get enough
credit. I think there was a lot of confusion early on about what partial methods were
and how they were used.
&lt;/p&gt;
&lt;p&gt;
Partial methods are intended to solve a major problem that is not only caused by code-generation
tools and also affects those same tools. For instance, you are writing a code-generation
tool but want to provide a way for the developers that are using your generated classes
to hook in to specific areas of the code. As such, you don't want them editing your
generated code since those customizations will be lost the next time the tool runs.
On the flip side of this scenario is the developer who needs to write the code that
hooks into those specific areas and doesn't want that code being lost the next time
the tool runs.
&lt;/p&gt;
&lt;p&gt;
Delegates are one solution to this type of problem. In the generated code, you declare
a delegate method that you then call at the appropriate areas. If no one has implemented
a concrete version of the delegate, the call will not do anything. However, if someone
has implemented am instance of that delegate then the call will run the code in that
instance. This sounds like a pretty good solution, and, until partial methods it really
was the only solution. The drawback is that the code for the delegate is always compiled
in to the runtime of your application and add to the runtime overhead of application
(granted, that overhead is minimal but it's still there).
&lt;/p&gt;
&lt;p&gt;
Partial classes helped with this problem by allowing the code-generation tools to
isolate the generated code in a partial class. This allowed the developer to add their
own methods to the class without fear that they would be overwritten the next time
the tool ran. However, it only helped partially. In order to accomplish our scenario,
you still needed to provide a delegate to allow the developer to hook into your process.
&lt;/p&gt;
&lt;p&gt;
If we take this a step further and look at partial methods, you will start to see
how they work and what the benefit is of using them. The following rules govern how
partials methods can be declared and used:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Must be declared inside a partial class. 
&lt;li&gt;
Must be declared as a &lt;strong&gt;void&lt;/strong&gt; return type. 
&lt;li&gt;
Must be declared with the &lt;strong&gt;partial&lt;/strong&gt;. 
&lt;li&gt;
Cannot be marked as &lt;strong&gt;extern&lt;/strong&gt;. 
&lt;li&gt;
Can be marked &lt;strong&gt;static&lt;/strong&gt; or &lt;strong&gt;unsafe&lt;/strong&gt;. 
&lt;li&gt;
Can be generic. 
&lt;li&gt;
Can have &lt;strong&gt;ref&lt;/strong&gt; but not &lt;strong&gt;out&lt;/strong&gt; parameters. 
&lt;li&gt;
Cannot be referenced as a delegate until they are implemented 
&lt;li&gt;
Cannot have access modifiers such as &lt;strong&gt;public&lt;/strong&gt;, &lt;strong&gt;private&lt;/strong&gt; or &lt;strong&gt;internal&lt;/strong&gt;. 
&lt;li&gt;
Cannot be declared as &lt;strong&gt;virtual&lt;/strong&gt;. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Partial methods are implicitly marked as private. This means they cannot be called
from outside the partial class.
&lt;/p&gt;
&lt;p&gt;
Now that we have the rules out of the way, let's take a look at an example. This is
a completely contrived example, as you typically wouldn't declare both portions of
the partial class yourself.
&lt;/p&gt;
&lt;div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 800px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, 'Courier New', courier, monospace; HEIGHT: 463px; BACKGROUND-COLOR: #f4f4f4"&gt;
&lt;div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 1:&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;//
This is the class that would normally have been autogenerated.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 2:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt; CustomTypedCollection&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 4:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; BeforeAddingElement(CustomElement
element);&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 6:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; AddElement(CustomElement
element)&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 7:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 8:&lt;/span&gt; BeforeAddingElement();&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 9:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 10:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 12:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt; CustomTypedCollection&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 13:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 14:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; BeforeAddingElement(CustomElement
element)&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 15:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 16:&lt;/span&gt; Console.WriteLine(&lt;span style="COLOR: #006080"&gt;"Element
"&lt;/span&gt; + element + &lt;span style="COLOR: #006080"&gt;" is being added."&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 17:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 18:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 20:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 21:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 22:&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;[]
args)&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 23:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 24:&lt;/span&gt; CustomTypedCollection
c = &lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt; CustomTypedCollection();&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 25:&lt;/span&gt; c.AddElemeent(&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt; CustomElement());&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 26:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt; 27:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
In this example, the code-generation tool declares a partial method BeforeAddingElement.
It is declared as just a function prototype with no implementation. Effectively, this
tells the developer that if they want to hook in to the AddElement process, they can
do so by declaring an implementation of the BeforeAddingElement method. If an implementation
is declared, the implementation and the call inside AddElement will be compiled in
to the runtime code. However, if no implementation is declared the call will be optimized
by the compiler and it will be entirely eliminated in the runtime code.
&lt;/p&gt;
&lt;p&gt;
This mechanism provides a lot of the same flexibility as delegates without the runtime
overhead. It also allows the developer to work with a much smaller implementation
of their portion of the partial class that contains only the few partial methods that
have been implemented.
&lt;/p&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,21a31223-2c2f-4c5e-a2e7-3bc76a7bc9b3.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p class="big">
          <strong>Which .NET Framework Data Provider to Use?</strong>
        </p>
        <p class="big">
To achieve the best performance for your application, use the .NET Framework data
provider that is most appropriate for your data source. There are a number of data
provider options for use in your applications. The following table provides information
about the available data providers and which data sources a data provider is most
appropriate for. 
</p>
        <blockquote>
          <table id="AutoNumber1" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellspacing="4" cellpadding="2" width="98%" border="1">
            <tbody>
              <tr>
                <td valign="top" width="33%">
                  <p>
                    <font size="2">
                      <strong>Provider</strong>
                    </font>
                  </p>
                </td>
                <td valign="top" width="67%">
                  <p>
                    <font size="2">
                      <strong>Details </strong>
                    </font>
                  </p>
                </td>
              </tr>
              <tr>
                <td valign="top" width="33%">
                  <p>
                    <font size="1">SQL Server .NET Data Provider </font>
                  </p>
                </td>
                <td valign="top" width="67%">
                  <p class="normal">
                    <font size="1">Found in the <b>System.Data.SqlClient</b> namespace. </font>
                  </p>
                  <p class="normal">
                    <font size="1">Recommended for middle-tier applications using Microsoft SQL Server
version 7.0 or later. </font>
                  </p>
                  <p class="normal">
                    <font size="1">Recommended for single-tier applications using the Microsoft Data Engine
(MSDE) or Microsoft SQL Server 7.0 or later. </font>
                  </p>
                </td>
              </tr>
              <tr>
                <td valign="top" width="33%">
                  <p>
                    <font size="1">OLE DB .NET Data Provider </font>
                  </p>
                </td>
                <td valign="top" width="67%">
                  <p class="normal">
                    <font size="1">Found in the <b>System.Data.OleDb</b> namespace. </font>
                  </p>
                  <p class="normal">
                    <font size="1">Recommended for middle-tier applications using Microsoft SQL Server
6.5 or earlier, or any OLE DB provider that supports the OLE DB interfaces listed
in OLE DB Interfaces Used by the OLE DB .NET Data Provider in the .NET Framework SDK. </font>
                  </p>
                  <p class="normal">
                    <font size="1">For Microsoft SQL Server 7.0 or later, the .NET Framework Data Provider
for SQL Server is recommended. </font>
                  </p>
                  <p class="normal">
                    <font size="1">Recommended for single-tier applications using a Microsoft® Access
database. Use of an Access database for a middle-tier application is not recommended. </font>
                  </p>
                </td>
              </tr>
              <tr>
                <td valign="top" width="33%">
                  <p>
                    <font size="1">ODBC .NET Data Provider </font>
                  </p>
                </td>
                <td valign="top" width="67%">
                  <p class="normal">
                    <font size="1">Found in the <b>Microsoft.Data.Odbc</b> namespace. </font>
                  </p>
                  <p class="normal">
                    <font size="1">The ODBC .NET Data Provider is available for </font>
                    <a href="http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/MSDN-FILES/027/001/668/msdncompositedoc.xml">
                      <font size="1">download</font>
                    </a>
                    <font size="1">. </font>
                  </p>
                  <p class="normal">
                    <font size="1">Provides access to data sources that are connected to using an ODBC
driver. </font>
                  </p>
                </td>
              </tr>
              <tr>
                <td valign="top" width="33%">
                  <p>
                    <font size="1">Oracle .NET Data Provider </font>
                  </p>
                </td>
                <td valign="top" width="67%">
                  <p>
                    <font size="1">Found in the <b>System.Data.OracleClient</b> namespace. </font>
                  </p>
                  <p>
                    <font size="1">The .NET Framework Data Provider for Oracle, unlike the Microsoft OLE
DB provider for Oracle, also supports new Oracle 9i datatypes, as well as ref cursors
(useful for running Oracle stored procedures that return result sets). This provider,
System.Data.OracleClient, is similar to the .NET Framework Data Provider for SQL Server,
System.Data.SqlClient. </font>
                  </p>
                  <p>
                    <font size="1">The Oracle .NET Data Provider is available for </font>
                    <a href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/940/msdncompositedoc.xml" target="_top">
                      <font size="1">download</font>
                    </a>
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </blockquote>
        <strong>
          <p>
            <br />
          </p>
        </strong>The fastest database read mechanism will be ADO.NET Data Readers, as
opposed to Data Sets.
<img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3" /></body>
      <title>Using .NET Framework Data Providers</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/19/UsingNETFrameworkDataProviders.aspx</link>
      <pubDate>Wed, 19 Dec 2007 07:40:12 GMT</pubDate>
      <description>&lt;p class=big&gt;
&lt;strong&gt;Which .NET Framework Data Provider to Use?&lt;/strong&gt; 
&lt;/p&gt;
&lt;p class=big&gt;
To achieve the best performance for your application, use the .NET Framework data
provider that is most appropriate for your data source. There are a number of data
provider options for use in your applications. The following table provides information
about the available data providers and which data sources a data provider is most
appropriate for. 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;table id=AutoNumber1 style="BORDER-COLLAPSE: collapse" bordercolor=#111111 cellspacing=4 cellpadding=2 width="98%" border=1&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign=top width="33%"&gt;
&lt;p&gt;
&lt;font size=2&gt;&lt;strong&gt;Provider&lt;/strong&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign=top width="67%"&gt;
&lt;p&gt;
&lt;font size=2&gt;&lt;strong&gt;Details &lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=top width="33%"&gt;
&lt;p&gt;
&lt;font size=1&gt;SQL Server .NET Data Provider &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign=top width="67%"&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Found in the &lt;b&gt;System.Data.SqlClient&lt;/b&gt; namespace. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Recommended for middle-tier applications using Microsoft SQL Server version
7.0 or later. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Recommended for single-tier applications using the Microsoft Data Engine
(MSDE) or Microsoft SQL Server 7.0 or later. &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=top width="33%"&gt;
&lt;p&gt;
&lt;font size=1&gt;OLE DB .NET Data Provider &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign=top width="67%"&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Found in the &lt;b&gt;System.Data.OleDb&lt;/b&gt; namespace. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Recommended for middle-tier applications using Microsoft SQL Server 6.5
or earlier, or any OLE DB provider that supports the OLE DB interfaces listed in OLE
DB Interfaces Used by the OLE DB .NET Data Provider in the .NET Framework SDK. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;For Microsoft SQL Server 7.0 or later, the .NET Framework Data Provider
for SQL Server is recommended. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Recommended for single-tier applications using a Microsoft® Access database.
Use of an Access database for a middle-tier application is not recommended. &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=top width="33%"&gt;
&lt;p&gt;
&lt;font size=1&gt;ODBC .NET Data Provider &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign=top width="67%"&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Found in the &lt;b&gt;Microsoft.Data.Odbc&lt;/b&gt; namespace. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;The ODBC .NET Data Provider is available for &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/MSDN-FILES/027/001/668/msdncompositedoc.xml"&gt;&lt;font size=1&gt;download&lt;/font&gt;&lt;/a&gt;&lt;font size=1&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=normal&gt;
&lt;font size=1&gt;Provides access to data sources that are connected to using an ODBC driver. &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=top width="33%"&gt;
&lt;p&gt;
&lt;font size=1&gt;Oracle .NET Data Provider&gt; &lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign=top width="67%"&gt;
&lt;p&gt;
&lt;font size=1&gt;Found in the &lt;b&gt;System.Data.OracleClient&lt;/b&gt; namespace. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=1&gt;The .NET Framework Data Provider for Oracle, unlike the Microsoft OLE
DB provider for Oracle, also supports new Oracle 9i datatypes, as well as ref cursors
(useful for running Oracle stored procedures that return result sets). This provider,
System.Data.OracleClient, is similar to the .NET Framework Data Provider for SQL Server,
System.Data.SqlClient. &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=1&gt;The Oracle .NET Data Provider is available for &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/940/msdncompositedoc.xml" target=_top&gt;&lt;font size=1&gt;download&lt;/font&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/blockquote&gt;&lt;strong&gt; 
&lt;p&gt;
&lt;br&gt;
&lt;/strong&gt;The fastest database read mechanism will be ADO.NET Data Readers, as opposed
to Data Sets.&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,ecf1047a-7ea7-46e8-b8f0-29fe4d6c77c3.aspx</comments>
      <category>.Net</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=4a488ad8-50bd-4854-bb28-30ffe78c07b5</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,4a488ad8-50bd-4854-bb28-30ffe78c07b5.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,4a488ad8-50bd-4854-bb28-30ffe78c07b5.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4a488ad8-50bd-4854-bb28-30ffe78c07b5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today, <a href="http://code.google.com/apis/chart">Google released their Chart
API</a>. Basically, the Google Chart API allows you to dynamically generate charts
for use in your web applications. All you do is pass your data in the querystring
and an image is returned. This isn't really a service to get too excited about, but
it is pretty simple to use and it's Free.
</p>
        <p>
          <strong>Here is a bit about this:</strong>
        </p>
        <p>
          <a id="content" name="content">
          </a>The Google Chart API lets you dynamically generate
charts. To see the Chart API in action, open up a browser window and copy the following
URL into it:
</p>
        <p>
          <code>http://chart.apis.google.com/chart?cht=p3&amp;chd=s:hW&amp;chs=250x100&amp;chl=Hello|World</code>
        </p>
        <p>
Press the Enter or Return key and - presto! - you should see the following image:
</p>
        <p>
          <img alt="Yellow line chart" src="http://chart.apis.google.com/chart?cht=p3&amp;chd=s:hW&amp;chs=250x100&amp;chl=Hello|World" border="0" />
        </p>
        <p>
I decided to code up a small ASP.NET Server Control that uses the Google Chart API
to put simple line graph charts on a page.
</p>
        <p>
          <strong>How to use this control:</strong>
        </p>
        <p>
Put the Chart control on the page:
</p>
        <p>
          <font color="#0000ff">&lt;</font>
          <font color="#a31515">GoogleAPI</font>
          <font color="#0000ff">:</font>
          <font color="#a31515">Chart</font>
          <font color="#ff0000">runat</font>
          <font color="#0000ff">="server"</font>
          <font color="#ff0000">id</font>
          <font color="#0000ff">="Chart1"</font> <br /><font color="#ff0000">   Width</font><font color="#0000ff">="200"</font><font color="#ff0000">Height</font><font color="#0000ff">="150"</font><font color="#ff0000">LineColor</font><font color="#0000ff">="ff0000"<br /></font><font color="#ff0000">   BackgroundColor</font><font color="#0000ff">="efefef"<br /></font><font color="#ff0000">   ToolTip</font><font color="#0000ff">="Hello
World"&gt;<br /></font><font color="#0000ff">&lt;/</font><font color="#a31515">GoogleAPI</font><font color="#0000ff">:</font><font color="#a31515">Chart</font><font color="#0000ff">&gt;</font></p>
        <p>
          <strong>In the page load event define the values to be charted:</strong>
        </p>
        <font color="#0000ff">
          <p>
Chart1.MaxValue = 60;<br /><br />
Chart1.Values.Clear();<br /><br />
Chart1.Values.Add(<font color="#a31515">"Jan"</font>, 10);<br />
Chart1.Values.Add(<font color="#a31515">"Feb"</font>, 20);<br />
Chart1.Values.Add(<font color="#a31515">"Mar"</font>, 30);<br />
Chart1.Values.Add(<font color="#a31515">"Apr"</font>, 50);<br />
Chart1.Values.Add(<font color="#a31515">"May"</font>, 5);<br />
Chart1.YAxisLabels.Add(<font color="#a31515">"0 Kb"</font>);<br />
Chart1.YAxisLabels.Add(<font color="#a31515">"25+ Kb"</font>);<br />
Chart1.YAxisLabels.Add(<font color="#a31515">"50+ Kb"</font>);
</p>
        </font>
        <p>
And, that's all you have to do to put a Chart on your page using the control.
</p>
        <p>
The result is this:
</p>
        <p>
          <img src="http://www.spotgnome.com/content/binary/chart.png" border="0" />
        </p>
        <p>
Download the example / source code here: <a href="http://www.spotgnome.com/content/binary/GoogleChartAPI.rar">GoogleChartAPI.rar
(3.33 KB)</a></p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=4a488ad8-50bd-4854-bb28-30ffe78c07b5" />
      </body>
      <title>Google Charts API: an ASP.NET 2.0 Server Control </title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,4a488ad8-50bd-4854-bb28-30ffe78c07b5.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/10/GoogleChartsAPIAnASPNET20ServerControl.aspx</link>
      <pubDate>Mon, 10 Dec 2007 14:21:29 GMT</pubDate>
      <description>&lt;p&gt;
Today,&amp;nbsp;&lt;a href="http://code.google.com/apis/chart"&gt;Google released their Chart
API&lt;/a&gt;. Basically, the Google Chart API allows you to dynamically generate charts
for use in your web applications. All you do is pass your data in the querystring
and an image is returned. This isn't really a service to get too excited about, but
it is pretty simple to use and it's Free.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Here is a bit about this:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a id=content name=content&gt;&lt;/a&gt;The Google Chart API lets you dynamically generate
charts. To see the Chart API in action, open up a browser window and copy the following
URL into it:
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;http://chart.apis.google.com/chart?cht=p3&amp;amp;chd=s:hW&amp;amp;chs=250x100&amp;amp;chl=Hello|World&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Press the Enter or Return key and - presto! - you should see the following image:
&lt;/p&gt;
&lt;p&gt;
&lt;img alt="Yellow line chart" src="http://chart.apis.google.com/chart?cht=p3&amp;amp;chd=s:hW&amp;amp;chs=250x100&amp;amp;chl=Hello|World" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I decided to code up a small ASP.NET Server Control that uses the Google Chart API
to put simple line graph charts on a page.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How to use this control:&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Put the Chart control on the page:
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#0000ff&gt;&amp;lt;&lt;/font&gt;&lt;font color=#a31515&gt;GoogleAPI&lt;/font&gt;&lt;font color=#0000ff&gt;:&lt;/font&gt;&lt;font color=#a31515&gt;Chart&lt;/font&gt; &lt;font color=#ff0000&gt;runat&lt;/font&gt;&lt;font color=#0000ff&gt;="server"&lt;/font&gt; &lt;font color=#ff0000&gt;id&lt;/font&gt;&lt;font color=#0000ff&gt;="Chart1"&lt;/font&gt;&amp;nbsp;&lt;br&gt;
&lt;font color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Width&lt;/font&gt;&lt;font color=#0000ff&gt;="200"&lt;/font&gt; &lt;font color=#ff0000&gt;Height&lt;/font&gt;&lt;font color=#0000ff&gt;="150"&lt;/font&gt; &lt;font color=#ff0000&gt;LineColor&lt;/font&gt;&lt;font color=#0000ff&gt;="ff0000"&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;BackgroundColor&lt;/font&gt;&lt;font color=#0000ff&gt;="efefef"&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ToolTip&lt;/font&gt;&lt;font color=#0000ff&gt;="Hello
World"&amp;gt;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#a31515&gt;GoogleAPI&lt;/font&gt;&lt;font color=#0000ff&gt;:&lt;/font&gt;&lt;font color=#a31515&gt;Chart&lt;/font&gt;&lt;font color=#0000ff&gt;&amp;gt;&lt;/font&gt;&gt;&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;In the page load event define the values to be charted:&lt;/strong&gt;
&lt;/p&gt;
&lt;font color=#0000ff&gt; 
&lt;p&gt;
Chart1.MaxValue = 60;&lt;br&gt;
&lt;br&gt;
Chart1.Values.Clear();&lt;br&gt;
&lt;br&gt;
Chart1.Values.Add(&lt;font color=#a31515&gt;"Jan"&lt;/font&gt;, 10);&lt;br&gt;
Chart1.Values.Add(&lt;font color=#a31515&gt;"Feb"&lt;/font&gt;, 20);&lt;br&gt;
Chart1.Values.Add(&lt;font color=#a31515&gt;"Mar"&lt;/font&gt;, 30);&lt;br&gt;
Chart1.Values.Add(&lt;font color=#a31515&gt;"Apr"&lt;/font&gt;, 50);&lt;br&gt;
Chart1.Values.Add(&lt;font color=#a31515&gt;"May"&lt;/font&gt;, 5);&lt;br&gt;
Chart1.YAxisLabels.Add(&lt;font color=#a31515&gt;"0 Kb"&lt;/font&gt;);&lt;br&gt;
Chart1.YAxisLabels.Add(&lt;font color=#a31515&gt;"25+ Kb"&lt;/font&gt;);&lt;br&gt;
Chart1.YAxisLabels.Add(&lt;font color=#a31515&gt;"50+ Kb"&lt;/font&gt;);
&lt;/p&gt;
&lt;/font&gt;&gt; 
&lt;p&gt;
And, that's all you have to do to put a Chart on your page using the&amp;nbsp;control.
&lt;/p&gt;
&lt;p&gt;
The result is this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.spotgnome.com/content/binary/chart.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Download the example / source code here: &lt;a href="http://www.spotgnome.com/content/binary/GoogleChartAPI.rar"&gt;GoogleChartAPI.rar
(3.33 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=4a488ad8-50bd-4854-bb28-30ffe78c07b5" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,4a488ad8-50bd-4854-bb28-30ffe78c07b5.aspx</comments>
      <category>.Net</category>
      <category>Google</category>
      <category>Programming</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=b0644c96-2b2f-475c-ad8c-2866aea2bd43</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,b0644c96-2b2f-475c-ad8c-2866aea2bd43.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,b0644c96-2b2f-475c-ad8c-2866aea2bd43.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b0644c96-2b2f-475c-ad8c-2866aea2bd43</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last week (december 5th) Microsoft announced the <a href="http://labs.live.com/volta/"><font color="#3399cc">Volta
technology preview</font></a>, a developer toolset for building multi-tier web applications
using existing and familiar tools, techniques and patterns. 
</p>
        <p>
Volta’s declarative tier-splitting enables developers to postpone architectural decisions
about distribution until the last possible responsible moment. Also, thanks to a shared
programming model across multiple-tiers, Volta enables new end-to-end profiling and
testing for higher levels of application performance, robustness, and reliability.
In effect, Volta extends the .NET platform to further enable the development of software+services
applications, using existing and familiar tools and techniques.
</p>
        <p>
You architect and build your application as a .NET client application, assigning the
portions of the application that run on the server tier and client tier late in the
development process. 
</p>
        <p>
After tier assignments, Volta's deep integration with Visual Studio debugger and testing
infrastructure dramatically improves the deployment experience for developers. 
</p>
        <ul>
          <li>
Volta automatically creates communication, serialization, and remoting code. Developers
simply write custom attributes on classes or methods to tell Volta the tier on which
to run them. 
</li>
          <li>
Developers may base tier assignments on any criteria, such as load management, performance,
or location of critical assets and capabilities. Because Volta automates the hidden
plumbing code, it is easy for developers to experiment with varying assignments of
classes and methods to tiers. 
</li>
          <li>
Developers can use all the .NET languages, libraries, and tools they already know,
including debuggers, profilers, test generators, refactoring, and code analysis tools. 
</li>
        </ul>
        <p>
Volta offers deep integration with Visual Studio 2008, including debuggers, profilers,
and testing frameworks. Developers can step through code seamlessly from one tier
to another, can set breakpoints on any tier, and trace flows of control across distributed
systems. 
</p>
        <p>
          <strong>What do you need to use Volta? </strong>
        </p>
        <div class="faq-a">The Volta developer toolset requires <strong>Visual Studio 2008
and the .NET Framework 3.5</strong> for writing and building applications. Volta applications
run virtually anywhere, even where an MSIL runtime is not available. A Volta client-side
application can run in most standards-compliant browsers, but can also be targetted
also take advantage of MSIL runtimes like the .NET CLR. 
</div>
        <div class="faq-a"> 
</div>
        <div class="faq-a">All this sounds great, except the requirements that are trying
to enforce the developers to use Visual Studio 2008 and the new .NET Framework 3.5.
</div>
        <div class="faq-a"> 
</div>
        <div class="faq-a">I wonder why the long wait for this release? And why it does not
compatible with .NET Framework 2.0?
</div>
        <div class="faq-a"> 
</div>
        <div class="faq-a">
          <strong>BTW, It is just me or the Volta logo reminds firefox logo
a bit:</strong>
        </div>
        <div class="faq-a"> 
</div>
        <p>
          <img src="http://www.spotgnome.com/content/binary/logo-volta.png" border="0" />  <font size="6"><strong>&lt;-
VS -&gt;</strong></font>    <img src="http://www.spotgnome.com/content/binary/firefox-logo-64x64.png" border="0" /></p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=b0644c96-2b2f-475c-ad8c-2866aea2bd43" />
      </body>
      <title>Microsoft Volta Technology</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,b0644c96-2b2f-475c-ad8c-2866aea2bd43.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/09/MicrosoftVoltaTechnology.aspx</link>
      <pubDate>Sun, 09 Dec 2007 12:41:46 GMT</pubDate>
      <description>&lt;p&gt;
Last week (december 5th)&amp;nbsp;Microsoft&amp;nbsp;announced the &lt;a href="http://labs.live.com/volta/"&gt;&lt;font color=#3399cc&gt;Volta
technology preview&lt;/font&gt;&lt;/a&gt;, a developer toolset for building multi-tier web applications
using existing and familiar tools, techniques and patterns. 
&lt;/p&gt;
&lt;p&gt;
Volta’s declarative tier-splitting enables developers to postpone architectural decisions
about distribution until the last possible responsible moment. Also, thanks to a shared
programming model across multiple-tiers, Volta enables new end-to-end profiling and
testing for higher levels of application performance, robustness, and reliability.
In effect, Volta extends the .NET platform to further enable the development of software+services
applications, using existing and familiar tools and techniques.
&lt;/p&gt;
&lt;p&gt;
You architect and build your application as a .NET client application, assigning the
portions of the application that run on the server tier and client tier late in the
development process. 
&lt;/p&gt;
&lt;p&gt;
After tier assignments, Volta's deep integration with Visual Studio debugger and testing
infrastructure dramatically improves the deployment experience for developers. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Volta automatically creates communication, serialization, and remoting code. Developers
simply write custom attributes on classes or methods to tell Volta the tier on which
to run them. 
&lt;li&gt;
Developers may base tier assignments on any criteria, such as load management, performance,
or location of critical assets and capabilities. Because Volta automates the hidden
plumbing code, it is easy for developers to experiment with varying assignments of
classes and methods to tiers. 
&lt;li&gt;
Developers can use all the .NET languages, libraries, and tools they already know,
including debuggers, profilers, test generators, refactoring, and code analysis tools. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Volta offers deep integration with Visual Studio 2008, including debuggers, profilers,
and testing frameworks. Developers can step through code seamlessly from one tier
to another, can set breakpoints on any tier, and trace flows of control across distributed
systems. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What do you need to use Volta? &lt;/strong&gt;
&lt;/p&gt;
&lt;div class=faq-a&gt;The Volta developer toolset requires &lt;strong&gt;Visual Studio 2008 and
the .NET Framework 3.5&lt;/strong&gt; for writing and building applications. Volta applications
run virtually anywhere, even where an MSIL runtime is not available. A Volta client-side
application can run in most standards-compliant browsers, but can also be targetted
also take advantage of MSIL runtimes like the .NET CLR. 
&lt;/div&gt;
&lt;div class=faq-a&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div class=faq-a&gt;All this sounds great, except the requirements that are trying to
enforce the developers to use Visual Studio 2008 and the new .NET Framework 3.5.
&lt;/div&gt;
&lt;div class=faq-a&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div class=faq-a&gt;I wonder why the long wait for this release? And why it does not
compatible with .NET Framework 2.0?
&lt;/div&gt;
&lt;div class=faq-a&gt;&amp;nbsp;
&lt;/div&gt;
&lt;div class=faq-a&gt;&lt;strong&gt;BTW, It is just me or the Volta logo reminds firefox logo
a bit:&lt;/strong&gt;
&lt;/div&gt;
&lt;div class=faq-a&gt;&amp;nbsp;
&lt;/div&gt;
&lt;p&gt;
&lt;img src="http://www.spotgnome.com/content/binary/logo-volta.png" border=0&gt;&amp;nbsp;&amp;nbsp;&lt;font size=6&gt;&lt;strong&gt;&amp;lt;-
VS -&amp;gt;&lt;/strong&gt;&lt;/font&gt;&amp;nbsp; &amp;nbsp; &lt;img src="http://www.spotgnome.com/content/binary/firefox-logo-64x64.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=b0644c96-2b2f-475c-ad8c-2866aea2bd43" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,b0644c96-2b2f-475c-ad8c-2866aea2bd43.aspx</comments>
      <category>.Net</category>
      <category>Microsoft</category>
      <category>Programming</category>
      <category>Visual Studio</category>
      <category>Volta</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=f5a94850-628c-47c3-a892-dadfa02ee9f1</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,f5a94850-628c-47c3-a892-dadfa02ee9f1.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,f5a94850-628c-47c3-a892-dadfa02ee9f1.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f5a94850-628c-47c3-a892-dadfa02ee9f1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is one of those "Yeah I've always seen people use it differently but I don't
know why!" questions. 
</p>
        <p>
Re-throwing exceptions can be misused, although it may not cause any harm to your
application - there are multiple ways of re-throwing an exception, most likely for
the purpose of bubbling it up to a higher level.
</p>
        <p>
Lets look at how many ways we can use <a href="http://msdn2.microsoft.com/en-us/library/1ah5wsex(VS.80).aspx">throw</a>: 
</p>
        <ol>
        </ol>
        <ol>
          <li>
throw 
</li>
          <li>
throw ex 
</li>
          <li>
throw new Exception(); </li>
        </ol>
        <p>
You should not use #3 except if you are throwing a specific exception other that the
one that was fired such as a custom exception. To re-throw an exception in .NET your
best option is #1 instead of #2 and that is simply because of how they stack
up in the <strong><u>stack trace</u></strong>. Lets take a look at the stack trace
for both instances using the following snippet.
</p>
        <p>
 
</p>
        <pre class="code">
          <span style="COLOR: rgb(0,0,255)">protected</span>
          <span style="COLOR: rgb(0,0,255)">void</span> Page_Load(<span style="COLOR: rgb(0,0,255)">object</span> sender, <span style="COLOR: rgb(43,145,175)">EventArgs</span> e)
{ <span style="COLOR: rgb(0,0,255)">try </span> { DoMath(); } <span style="COLOR: rgb(0,0,255)">catch</span>(<span style="COLOR: rgb(43,145,175)">Exception</span> ex)
{ <span style="COLOR: rgb(0,0,255)">throw</span> ex; } } <span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;summary&gt; </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"> A
method that simply calls another method. </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;/summary&gt; </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;remarks&gt; </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"> Just
a helper to show stack trace </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;/remarks&gt; </span><span style="COLOR: rgb(0,0,255)">private</span><span style="COLOR: rgb(0,0,255)">void</span> DoMath()
{ MethodWithError(); } <span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;summary&gt; </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"> This
method will throw an error </span><span style="COLOR: rgb(128,128,128)">///</span><span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(128,128,128)">&lt;/summary&gt; </span><span style="COLOR: rgb(0,0,255)">private</span><span style="COLOR: rgb(0,0,255)">void</span> MethodWithError()
{ <span style="COLOR: rgb(0,0,255)">throw</span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(43,145,175)">Exception</span>(<span style="COLOR: rgb(163,21,21)">"Generic
exception"</span>); }</pre>
        <p>
 
</p>
        <p>
The stack trace looks like this:
</p>
        <pre>
          <font color="#808080">[Exception: Generic exception] throwerror.Page_Load(Object
sender, EventArgs e) </font>
        </pre>
        <pre>
          <font color="#808080">in d:\My Websites\demoweb\throwerror.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller</font>
        </pre>
        <pre>
          <font color="#808080">(IntPtr
fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback</font>
        </pre>
        <pre>
          <font color="#808080">(Object
sender, EventArgs e) +34 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive()
+47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, </font>
        </pre>
        <pre>
          <font color="#808080">Boolean
includeStagesAfterAsyncPoint) +1061</font>
        </pre>
        <p>
 
</p>
        <p>
However, if I replace "<strong>throw ex;"</strong> with just "<strong>throw;",</strong> here
is the new stack trace.
</p>
        <p>
          <font color="#808080">[Exception: Generic exception]<br />
   throwerror.MethodWithError() in d:\My Websites\demoweb\throwerror.aspx.cs:42<br />
   throwerror.DoMath() in d:\My Websites\demoweb\throwerror.aspx.cs:34<br />
   throwerror.Page_Load(Object sender, EventArgs e) in d:\My Websites\demoweb\throwerror.aspx.cs:22<br />
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15<br />
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +34<br />
   System.Web.UI.Control.OnLoad(EventArgs e) +99<br />
   System.Web.UI.Control.LoadRecursive() +47<br />
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +1061</font>
        </p>
        <p>
 
</p>
        <p>
          <em>Its all about the details.</em> Obviously, using just "<strong>throw;</strong>"
gives us much more details - so use "<strong><u>throw</u></strong>" to <strong><u>re-throw</u></strong> an
error.
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=f5a94850-628c-47c3-a892-dadfa02ee9f1" />
      </body>
      <title>Re-Throwing An Exception</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,f5a94850-628c-47c3-a892-dadfa02ee9f1.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/04/ReThrowingAnException.aspx</link>
      <pubDate>Tue, 04 Dec 2007 15:10:06 GMT</pubDate>
      <description>&lt;p&gt;
This is one of those "Yeah I've always seen people use it differently but I don't
know why!" questions. 
&lt;/p&gt;
&lt;p&gt;
Re-throwing exceptions can be misused, although it may not cause any harm to your
application - there are multiple ways of re-throwing an exception, most likely for
the purpose of bubbling it up to a higher level.
&lt;/p&gt;
&lt;p&gt;
Lets look at how many ways we can use &lt;a href="http://msdn2.microsoft.com/en-us/library/1ah5wsex(VS.80).aspx"&gt;throw&lt;/a&gt;: 
&lt;/p&gt;
&lt;ol&gt;
&lt;ol&gt;
&lt;li&gt;
throw 
&lt;li&gt;
throw ex 
&lt;li&gt;
throw new Exception();&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&gt;
&lt;p&gt;
You should not use #3 except if you are throwing a specific exception other that the
one that was fired such as a custom exception. To re-throw an exception in .NET your
best option is #1 instead of #2 and that is simply because of how&amp;nbsp;they stack
up in the &lt;strong&gt;&lt;u&gt;stack trace&lt;/u&gt;&lt;/strong&gt;. Lets take a look at the stack trace
for both instances using the following snippet.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;pre class=code&gt;    &lt;span style="COLOR: rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;void&lt;/span&gt; Page_Load(&lt;span style="COLOR: rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: rgb(43,145,175)"&gt;EventArgs&lt;/span&gt; e)
{ &lt;span style="COLOR: rgb(0,0,255)"&gt;try &lt;/span&gt; { DoMath(); } &lt;span style="COLOR: rgb(0,0,255)"&gt;catch&lt;/span&gt;(&lt;span style="COLOR: rgb(43,145,175)"&gt;Exception&lt;/span&gt; ex)
{ &lt;span style="COLOR: rgb(0,0,255)"&gt;throw&lt;/span&gt; ex; } } &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;summary&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; A
method that simply calls another method. &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;/summary&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;remarks&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; Just
a helper to show stack trace &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;/remarks&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;void&lt;/span&gt; DoMath()
{ MethodWithError(); } &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;summary&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; This
method will throw an error &lt;/span&gt; &lt;span style="COLOR: rgb(128,128,128)"&gt;///&lt;/span&gt;&lt;span style="COLOR: rgb(0,128,0)"&gt; &lt;/span&gt;&lt;span style="COLOR: rgb(128,128,128)"&gt;&amp;lt;/summary&amp;gt; &lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;void&lt;/span&gt; MethodWithError()
{ &lt;span style="COLOR: rgb(0,0,255)"&gt;throw&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;Exception&lt;/span&gt;(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Generic
exception"&lt;/span&gt;); }&lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The stack trace looks like this:
&lt;/p&gt;
&lt;pre&gt;&lt;font color=#808080&gt;[Exception: Generic exception] throwerror.Page_Load(Object
sender, EventArgs e) &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font color=#808080&gt;in d:\My Websites\demoweb\throwerror.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font color=#808080&gt;(IntPtr
fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font color=#808080&gt;(Object
sender, EventArgs e) +34 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive()
+47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font color=#808080&gt;Boolean
includeStagesAfterAsyncPoint) +1061&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
However, if I replace "&lt;strong&gt;throw ex;"&lt;/strong&gt; with just "&lt;strong&gt;throw;",&lt;/strong&gt; here
is the new stack trace.
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#808080&gt;[Exception: Generic exception]&lt;br&gt;
&amp;nbsp;&amp;nbsp; throwerror.MethodWithError() in d:\My Websites\demoweb\throwerror.aspx.cs:42&lt;br&gt;
&amp;nbsp;&amp;nbsp; throwerror.DoMath() in d:\My Websites\demoweb\throwerror.aspx.cs:34&lt;br&gt;
&amp;nbsp;&amp;nbsp; throwerror.Page_Load(Object sender, EventArgs e) in d:\My Websites\demoweb\throwerror.aspx.cs:22&lt;br&gt;
&amp;nbsp;&amp;nbsp; System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15&lt;br&gt;
&amp;nbsp;&amp;nbsp; System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +34&lt;br&gt;
&amp;nbsp;&amp;nbsp; System.Web.UI.Control.OnLoad(EventArgs e) +99&lt;br&gt;
&amp;nbsp;&amp;nbsp; System.Web.UI.Control.LoadRecursive() +47&lt;br&gt;
&amp;nbsp;&amp;nbsp; System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +1061&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Its all about the details.&lt;/em&gt; Obviously, using just "&lt;strong&gt;throw;&lt;/strong&gt;"
gives us much more details - so use "&lt;strong&gt;&lt;u&gt;throw&lt;/u&gt;&lt;/strong&gt;" to &lt;strong&gt;&lt;u&gt;re-throw&lt;/u&gt;&lt;/strong&gt; an
error.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=f5a94850-628c-47c3-a892-dadfa02ee9f1" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,f5a94850-628c-47c3-a892-dadfa02ee9f1.aspx</comments>
      <category>.Net</category>
      <category>Visual Studio</category>
      <category>Programming</category>
    </item>
    <item>
      <trackback:ping>http://www.spotgnome.com/Trackback.aspx?guid=34fa187d-febc-4a63-baea-14ab6443d55c</trackback:ping>
      <pingback:server>http://www.spotgnome.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.spotgnome.com/PermaLink,guid,34fa187d-febc-4a63-baea-14ab6443d55c.aspx</pingback:target>
      <dc:creator>Guy Levin</dc:creator>
      <wfw:comment>http://www.spotgnome.com/CommentView,guid,34fa187d-febc-4a63-baea-14ab6443d55c.aspx</wfw:comment>
      <wfw:commentRss>http://www.spotgnome.com/SyndicationService.asmx/GetEntryCommentsRss?guid=34fa187d-febc-4a63-baea-14ab6443d55c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Now that the <a href="http://blogs.msdn.com/astebner/archive/2007/11/19/6408888.aspx">.NET
Framework 3.5 has been released</a>, this version includes logic to detect
the presence of the .NET Framework 3.5 and also .NET Framework 3.0 service packs,
which was missing from previous versions of this sample code.
</p>
        <p>
You can download updated versions of the sample code at the following locations:
</p>
        <ul>
          <li>
Registry-based detection code - <a title="http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt" href="http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt">http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt</a></li>
          <li>
Registry-based detection code and more in-depth checking that loads mscoree.dll (initially <a href="http://blogs.msdn.com/astebner/archive/2006/08/02/687233.aspx">described
here</a>) - <a title="http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt" href="http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt">http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt</a></li>
        </ul>
        <p>
For reference, the registry locations used in this sample code to detect the .NET
Framework 3.0 service pack level and the .NET Framework 3.5 are listed below.
</p>
        <p>
          <strong>To detect the .NET Framework 3.0 service pack level:</strong>
        </p>
        <blockquote>
          <p>
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0]<br />
SP = &lt;value&gt;
</p>
        </blockquote>
        <p>
Note - this SP value will not exist at all if you only have the original release of
the .NET Framework 3.0.  This value was added starting in the .NET Framework
3.0 SP1 and will be updated for future service packs.
</p>
        <p>
          <strong>To detect the .NET Framework 3.5 final release:</strong>
        </p>
        <blockquote>
          <p>
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]<br />
Install = 1<br />
Version = 3.5.21022.08
</p>
        </blockquote>
        <p>
          <strong>To detect the .NET Framework 3.5 service pack level:</strong>
        </p>
        <blockquote>
          <p>
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]<br />
SP = &lt;value&gt;
</p>
        </blockquote>
        <p>
Note - this SP value does exist in the final release of the .NET Framework 3.5, and
will be set to 0.  Future service packs will increment this value as appropriate.
</p>
        <img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=34fa187d-febc-4a63-baea-14ab6443d55c" />
      </body>
      <title>Detecting The .NET Framework 3.5</title>
      <guid isPermaLink="false">http://www.spotgnome.com/PermaLink,guid,34fa187d-febc-4a63-baea-14ab6443d55c.aspx</guid>
      <link>http://www.spotgnome.com/2007/12/04/DetectingTheNETFramework35.aspx</link>
      <pubDate>Tue, 04 Dec 2007 15:01:18 GMT</pubDate>
      <description>&lt;p&gt;
Now that the &lt;a href="http://blogs.msdn.com/astebner/archive/2007/11/19/6408888.aspx"&gt;.NET
Framework 3.5 has been released&lt;/a&gt;,&amp;nbsp;this&amp;nbsp;version includes logic to detect
the presence of the .NET Framework 3.5 and also .NET Framework 3.0 service packs,
which was missing from previous versions of this sample code.
&lt;/p&gt;
&lt;p&gt;
You can download updated versions of the sample code at the following locations:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Registry-based detection code - &lt;a title=http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt href="http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt"&gt;http://astebner.sts.winisp.net/Tools/detectFX.cpp.txt&lt;/a&gt; 
&lt;li&gt;
Registry-based detection code and more in-depth checking that loads mscoree.dll (initially &lt;a href="http://blogs.msdn.com/astebner/archive/2006/08/02/687233.aspx"&gt;described
here&lt;/a&gt;) - &lt;a title=http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt href="http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt"&gt;http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For reference, the registry locations used in this sample code to detect the .NET
Framework 3.0 service pack level and the .NET Framework 3.5 are listed below.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;To detect the .NET Framework 3.0 service pack level:&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0]&lt;br&gt;
SP = &amp;lt;value&amp;gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Note - this SP value will not exist at all if you only have the original release of
the .NET Framework 3.0.&amp;nbsp; This value was added starting in the .NET Framework
3.0 SP1 and will be updated for future service packs.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;To detect the .NET Framework 3.5 final release:&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]&lt;br&gt;
Install = 1&lt;br&gt;
Version = 3.5.21022.08
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;To detect the .NET Framework 3.5 service pack level:&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]&lt;br&gt;
SP = &amp;lt;value&amp;gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Note - this SP value does exist in the final release of the .NET Framework 3.5, and
will be set to 0.&amp;nbsp; Future service packs will increment this value as appropriate.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.spotgnome.com/aggbug.ashx?id=34fa187d-febc-4a63-baea-14ab6443d55c" /&gt;</description>
      <comments>http://www.spotgnome.com/CommentView,guid,34fa187d-febc-4a63-baea-14ab6443d55c.aspx</comments>
      <category>.Net</category>
      <category>Microsoft</category>
      <category>Visual Studio</category>
    </item>
  </channel>
</rss>