<?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>OOP - There It Is - Annoyances</title>
    <link>http://www.vpsw.com/blogbaby/</link>
    <description>A Very Practical Blog</description>
    <language>en-us</language>
    <copyright>Dean Fiala</copyright>
    <lastBuildDate>Fri, 06 Jun 2008 00:59:09 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>dfiala@vpsw.com</managingEditor>
    <webMaster>dfiala@vpsw.com</webMaster>
    <item>
      <trackback:ping>http://www.vpsw.com/blogbaby/Trackback.aspx?guid=3678a9bf-aeec-41a9-8041-e25671bd5fb5</trackback:ping>
      <pingback:server>http://www.vpsw.com/blogbaby/pingback.aspx</pingback:server>
      <pingback:target>http://www.vpsw.com/blogbaby/PermaLink,guid,3678a9bf-aeec-41a9-8041-e25671bd5fb5.aspx</pingback:target>
      <dc:creator>Dean</dc:creator>
      <wfw:comment>http://www.vpsw.com/blogbaby/CommentView,guid,3678a9bf-aeec-41a9-8041-e25671bd5fb5.aspx</wfw:comment>
      <wfw:commentRss>http://www.vpsw.com/blogbaby/SyndicationService.asmx/GetEntryCommentsRss?guid=3678a9bf-aeec-41a9-8041-e25671bd5fb5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Every month or so, someone posts a question on one of the .NET forums I frequent asking
if such and such will work, or if you can do so and so. The post will detail the background
of the issue, including theoretical approaches, possible drawbacks, imaginary contingencies
and tangential concepts.  Invariably the poster wants to know the "proper
way" to code something, and yet 6 paragraphs later hasn't shown what he or she
has already attempted.
</p>
        <p>
Why?
</p>
        <p>
Because the poster <em>hasn't written any code yet</em>.  
</p>
        <p>
Philosophical development discussions can be fun. Reviewing fundamental design issues,
or exploring the possibilities of a new technology or entering a new problem space
beg for "what if" questions. It's good to have an idea where to go, a vague
notion how to get there and to find out how others attempted the journey.  
Those are fun questions to answer.
</p>
        <p>
Another excellent time to ask "what if" questions is when facing an irrevocable
upgrade or configuration change.  When a wrong step can wreak havoc it wise to
ask for advice. That's what a forum is for -- to get pointed in the right direction
or pushed back on course or to be told to hurry back to shore. 
</p>
        <p>
No, what makes a coding "what if" question a total waste of time and bandwidth
is when it asks how to write a relatively small amount of code. The post itself is
longer than the most convoluted possible solution. To put it programmatically...
</p>
        <blockquote>
          <p>
            <font face="Courier New" color="#0000ff">
              <strong>if(Post.Length &gt; Code_Needed_To_See_If_It_Works.Length) 
<br />
    WasteOfTimeAndBandwidth();</strong>
            </font>
          </p>
        </blockquote>
        <p>
In other words, if the poster had actually tried to code one of the carefully penned
theoretical approaches, he or she would have ended up typing a lot less and would
have discovered the solution without a trip to forum land.  
</p>
        <p>
Some examples (and I wish I were making these up):
</p>
        <ul>
          <li>
Is it possible to set SomeObject.SomeProperty = SomeValue? 
</li>
          <li>
Can I put this control inside this other control? 
</li>
          <li>
How long will SomeObject.SomeMethod() take to run? 
</li>
        </ul>
        <p>
Programming is a wonderfully empirical undertaking. With IDEs (Integrated Development
Environments such as Visual Studio) it is easy to create code and test it.  At
the level of of a function or even a web page or windows form, there is no need for
thought experiments or theoretical ponderings -- the code either does what it is supposed
to or it doesn't.  There is no need to write <em>about</em> it -- just write
it.  If it doesn't work, then you can post a question that is based on something
real.
</p>
        <p>
Unless you are doing something silly like working on a production system, the cost
for trying something out is minimal.  In the worst cases, bad code throws an
error or just doesn't work.  Things don't explode, no one dies.  With source
code/version control (which everyone should get into the habit of using), it is trivial
to roll back to a previous working version.  
</p>
        <p>
So please, for your sake and Pete's, try it first.  See what happens.  You'll
save some time and might be pleasantly surprised. 
</p>
        <img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=3678a9bf-aeec-41a9-8041-e25671bd5fb5" />
      </body>
      <title>For Pete's Sake -- Just Try It</title>
      <guid isPermaLink="false">http://www.vpsw.com/blogbaby/PermaLink,guid,3678a9bf-aeec-41a9-8041-e25671bd5fb5.aspx</guid>
      <link>http://www.vpsw.com/blogbaby/PermaLink,guid,3678a9bf-aeec-41a9-8041-e25671bd5fb5.aspx</link>
      <pubDate>Fri, 06 Jun 2008 00:59:09 GMT</pubDate>
      <description>&lt;p&gt;
Every month or so, someone posts a question on one of the .NET forums I frequent asking
if such and such will work, or if you can do so and so. The post will detail the background
of the issue, including theoretical approaches, possible drawbacks, imaginary contingencies
and tangential concepts.&amp;#160; Invariably the poster wants to know the &amp;quot;proper
way&amp;quot; to code something, and yet 6 paragraphs later hasn't shown what he or she
has already attempted.
&lt;/p&gt;
&lt;p&gt;
Why?
&lt;/p&gt;
&lt;p&gt;
Because the poster &lt;em&gt;hasn't written any code yet&lt;/em&gt;.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
Philosophical development discussions can be fun. Reviewing fundamental design issues,
or exploring the possibilities of a new technology or entering a new problem space
beg for &amp;quot;what if&amp;quot; questions. It's good to have an idea where to go, a vague
notion how to get there and to find out how others attempted the journey.&amp;#160;&amp;#160;
Those are fun questions to answer.
&lt;/p&gt;
&lt;p&gt;
Another excellent time to ask &amp;quot;what if&amp;quot; questions is when facing an irrevocable
upgrade or configuration change.&amp;#160; When a wrong step can wreak havoc it wise to
ask for advice. That's what a forum is for -- to get pointed in the right direction
or pushed back on course or to be told to hurry back to shore. 
&lt;/p&gt;
&lt;p&gt;
No, what makes a coding &amp;quot;what if&amp;quot; question a total waste of time and bandwidth
is when it asks how to write a relatively small amount of code. The post itself is
longer than the most convoluted possible solution. To put it programmatically...
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" color="#0000ff"&gt;&lt;strong&gt;if(Post.Length &amp;gt; Code_Needed_To_See_If_It_Works.Length) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; WasteOfTimeAndBandwidth();&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
In other words, if the poster had actually tried to code one of the carefully penned
theoretical approaches, he or she would have ended up typing a lot less and would
have discovered the solution without a trip to forum land.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
Some examples (and I wish I were making these up):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Is it possible to set SomeObject.SomeProperty = SomeValue? 
&lt;/li&gt;
&lt;li&gt;
Can I put this control inside this other control? 
&lt;/li&gt;
&lt;li&gt;
How long will SomeObject.SomeMethod() take to run? 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Programming is a wonderfully empirical undertaking. With IDEs (Integrated Development
Environments such as Visual Studio) it is easy to create code and test it.&amp;#160; At
the level of of a function or even a web page or windows form, there is no need for
thought experiments or theoretical ponderings -- the code either does what it is supposed
to or it doesn't.&amp;#160; There is no need to write &lt;em&gt;about&lt;/em&gt; it -- just write
it.&amp;#160; If it doesn't work, then you can post a question that is based on something
real.
&lt;/p&gt;
&lt;p&gt;
Unless you are doing something silly like working on a production system, the cost
for trying something out is minimal.&amp;#160; In the worst cases, bad code throws an
error or just doesn't work.&amp;#160; Things don't explode, no one dies.&amp;#160; With source
code/version control (which everyone should get into the habit of using), it is trivial
to roll back to a previous working version.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
So please, for your sake and Pete's, try it first.&amp;#160; See what happens.&amp;#160; You'll
save some time and might be pleasantly surprised. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=3678a9bf-aeec-41a9-8041-e25671bd5fb5" /&gt;</description>
      <comments>http://www.vpsw.com/blogbaby/CommentView,guid,3678a9bf-aeec-41a9-8041-e25671bd5fb5.aspx</comments>
      <category>Annoyances</category>
      <category>Da Basics</category>
    </item>
    <item>
      <trackback:ping>http://www.vpsw.com/blogbaby/Trackback.aspx?guid=0f4be836-38ff-4e93-a29b-4282e979372c</trackback:ping>
      <pingback:server>http://www.vpsw.com/blogbaby/pingback.aspx</pingback:server>
      <pingback:target>http://www.vpsw.com/blogbaby/PermaLink,guid,0f4be836-38ff-4e93-a29b-4282e979372c.aspx</pingback:target>
      <dc:creator>Dean</dc:creator>
      <wfw:comment>http://www.vpsw.com/blogbaby/CommentView,guid,0f4be836-38ff-4e93-a29b-4282e979372c.aspx</wfw:comment>
      <wfw:commentRss>http://www.vpsw.com/blogbaby/SyndicationService.asmx/GetEntryCommentsRss?guid=0f4be836-38ff-4e93-a29b-4282e979372c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I hate upgrades.  I usually put them off until:
</p>
        <ol>
          <li>
Something (someone) puts a gun to my head</li>
          <li>
There is a compelling feature available</li>
          <li>
I'm feeling lucky<br /></li>
        </ol>
        <p>
Case 1 is the usual situation.  When things won't work any more, I'll bite the
bullet.  If things are working, I have a tendency to leave them alone because
vast experience has taught me that the Law of Unintended Consequences usually makes
itself known whenever something gets upgraded.  I don't care how many versions
behind it is.  I don't like to blow half a day getting back to where I was before
the upgrade.
</p>
        <p>
 
</p>
        <p>
Case 2 actually popped up twice in the last month.  I moved to Vista finally
because I wanted to play with the new PeerToPeer.Collaboration namespace in 3.5. 
It hasn't been too horrible, (except for the file search function which is even more
obtuse than it was in XP -- which I thought was an impossibility).  It was also
just a move to a fresh machine.  I also upgraded my <a href="http://www.thycotic.com/products_secretserver_overview.html"> my
password management software</a> (SecretServer) install, because I wanted to take
advantage of the ActiveDirectory feature.  I was only 3 major versions, 2 minor
versions and 30 revisions behind, but with some help from the good support folks at
Thycotic I was able to get it current without too much hassle.
</p>
        <p>
 
</p>
        <p>
Case 3 is something I should avoid.  I should know better, but it happened while
I fooling around with this blog last week.  I realized that the blog software
(<a href="http://www.dasblog.info/">dasBlog</a>) was many versions behind and I figured
the last upgrade hadn't been too bad.  There were also a couple quirks I figured
would be handled by the new version.  So  I downloaded all the new stuff,
merged my web.config file, made the few other changes and pushed everything up. 
Worked, mostly.  I couldn't edit or enter new entries.  The FreeTextBox
component was displaying a "was not installed correctly" error.  Hours of googling,
typing, begging and swearing later still no luck.
</p>
        <p>
 
</p>
        <p>
So tonight I decided it was time to move on.  dasBlog supports other editors,
and John Forsythe has created <a href="http://preview.tinyurl.com/6br7kt">a lovely
little addin</a> for the <a href="http://tinymce.moxiecode.com/">TinyMCE</a> rich
text editor.  I downloaded, uploaded, recycled the app, changed the configuration
and behold my dasBlog install once again is back where it was a week ago -- I have
a text editor to create entries.
</p>
        <p>
 
</p>
        <p>
On the positive side, TinyMCE is has more features and the new dasBlog goodies are
nice, so I guess it was a worthwhile exercise.  I'm just posting this to remind
myself that I should "never feel lucky" when considering an upgrade.
</p>
        <p>
 
</p>
        <p>
          <strong>UPDATE:</strong>  Just discovered Comments weren't working because I
had the Resolve IP Setting turned on. Looks good now. Not that I get lots of comments,
but I would like to provide the outlet.
</p>
        <p>
 
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=0f4be836-38ff-4e93-a29b-4282e979372c" />
      </body>
      <title>Something (Kinda) New </title>
      <guid isPermaLink="false">http://www.vpsw.com/blogbaby/PermaLink,guid,0f4be836-38ff-4e93-a29b-4282e979372c.aspx</guid>
      <link>http://www.vpsw.com/blogbaby/PermaLink,guid,0f4be836-38ff-4e93-a29b-4282e979372c.aspx</link>
      <pubDate>Thu, 29 May 2008 02:22:05 GMT</pubDate>
      <description>&lt;p&gt;
I hate upgrades.&amp;nbsp; I usually put them off until:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Something (someone) puts a gun to my head&lt;/li&gt;
&lt;li&gt;
There is a compelling feature available&lt;/li&gt;
&lt;li&gt;
I'm feeling lucky&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Case 1 is the usual situation.&amp;nbsp; When things won't work any more, I'll bite the
bullet.&amp;nbsp; If things are working, I have a tendency to leave them alone because
vast experience has taught me that the Law of Unintended Consequences usually makes
itself known whenever something gets upgraded.&amp;nbsp; I don't care how many versions
behind it is.&amp;nbsp; I don't like to blow half a day getting back to where I was before
the upgrade.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Case 2 actually popped up twice in the last month.&amp;nbsp; I moved to Vista finally
because I wanted to play with the new PeerToPeer.Collaboration namespace in 3.5.&amp;nbsp;
It hasn't been too horrible, (except for the file search function which is even more
obtuse than it was in XP -- which I thought was an impossibility).&amp;nbsp; It was also
just a move to a fresh machine.&amp;nbsp; I also upgraded my &lt;a href="http://www.thycotic.com/products_secretserver_overview.html"&gt; my
password management software&lt;/a&gt; (SecretServer) install, because I wanted to take
advantage of the ActiveDirectory feature.&amp;nbsp; I was only 3 major versions, 2 minor
versions and 30 revisions behind, but with some help from the good support folks at
Thycotic I was able to get it current without too much hassle.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Case 3 is something I should avoid.&amp;nbsp; I should know better, but it happened while
I fooling around with this blog last week.&amp;nbsp; I realized that the blog software
(&lt;a href="http://www.dasblog.info/"&gt;dasBlog&lt;/a&gt;) was many versions behind and I figured
the last upgrade hadn't been too bad.&amp;nbsp; There were also a couple quirks I figured
would be handled by the new version.&amp;nbsp; So&amp;nbsp; I downloaded all the new stuff,
merged my web.config file, made the few other changes and pushed everything up.&amp;nbsp;
Worked, mostly.&amp;nbsp; I couldn't edit or enter new entries.&amp;nbsp; The FreeTextBox
component was displaying a "was not installed correctly" error.&amp;nbsp; Hours of googling,
typing, begging and swearing later still no luck.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
So tonight I decided it was time to move on.&amp;nbsp; dasBlog supports other editors,
and John Forsythe has created &lt;a href="http://preview.tinyurl.com/6br7kt"&gt;a lovely
little addin&lt;/a&gt; for the &lt;a href="http://tinymce.moxiecode.com/"&gt;TinyMCE&lt;/a&gt; rich
text editor.&amp;nbsp; I downloaded, uploaded, recycled the app, changed the configuration
and behold my dasBlog install once again is back where it was a week ago -- I have
a text editor to create entries.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
On the positive side, TinyMCE is has more features and the new dasBlog goodies are
nice, so I guess it was a worthwhile exercise.&amp;nbsp; I'm just posting this to remind
myself that I should "never feel lucky" when considering an upgrade.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;UPDATE:&lt;/strong&gt;&amp;nbsp; Just discovered Comments weren't working because I
had the Resolve IP Setting turned on. Looks good now. Not that I get lots of comments,
but I would like to provide the outlet.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=0f4be836-38ff-4e93-a29b-4282e979372c" /&gt;</description>
      <comments>http://www.vpsw.com/blogbaby/CommentView,guid,0f4be836-38ff-4e93-a29b-4282e979372c.aspx</comments>
      <category>Annoyances</category>
      <category>dasBlog</category>
    </item>
    <item>
      <trackback:ping>http://www.vpsw.com/blogbaby/Trackback.aspx?guid=e731f69b-b1ac-4779-a54c-0a662d5dd64a</trackback:ping>
      <pingback:server>http://www.vpsw.com/blogbaby/pingback.aspx</pingback:server>
      <pingback:target>http://www.vpsw.com/blogbaby/PermaLink,guid,e731f69b-b1ac-4779-a54c-0a662d5dd64a.aspx</pingback:target>
      <dc:creator>Dean</dc:creator>
      <wfw:comment>http://www.vpsw.com/blogbaby/CommentView,guid,e731f69b-b1ac-4779-a54c-0a662d5dd64a.aspx</wfw:comment>
      <wfw:commentRss>http://www.vpsw.com/blogbaby/SyndicationService.asmx/GetEntryCommentsRss?guid=e731f69b-b1ac-4779-a54c-0a662d5dd64a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">It seems every 3 years or so I need to
be slapped upside the head and reminded that in SQL Server...<br /><br /><font color="#ff0000">record order in a result set is not guaranteed unless you use <b>ORDER
BY</b></font><br /><br />
So I don't have to be hit in the head again, I'm writing it down. 
<br /><br />
The issue is that:<br />
frequently the results ARE returned in order of entry<br />
and 
<br />
frequently developers start assuming that will always be the case<br />
and<br />
frequently developers build code based on that assumption.<br /><br />
Months go by.<br /><br />
Then a subtle bug occasionally appears and someone spends the better part of an evening
trying to replicate the bug, and finally generates mostly, but not entirely correct
results.  By all appearances nothing is missing, but the code is angry when prodded
just so.  Running the underlying stored procedure in Query Analyzer reveals that
the records being returned are slightly out of order. The relevant SELECT statement
lacks an ORDER BY clause.  The clause is added.  The records are returned
in the expected order.  The code is happy.  The developer can go to sleep.<br /><p></p><img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=e731f69b-b1ac-4779-a54c-0a662d5dd64a" /></body>
      <title>When You Assume</title>
      <guid isPermaLink="false">http://www.vpsw.com/blogbaby/PermaLink,guid,e731f69b-b1ac-4779-a54c-0a662d5dd64a.aspx</guid>
      <link>http://www.vpsw.com/blogbaby/PermaLink,guid,e731f69b-b1ac-4779-a54c-0a662d5dd64a.aspx</link>
      <pubDate>Fri, 08 Jun 2007 14:40:53 GMT</pubDate>
      <description>It seems every 3 years or so I need to be slapped upside the head and reminded that in SQL Server...&lt;br&gt;
&lt;br&gt;
&lt;font color="#ff0000"&gt;record order in a result set is not guaranteed unless you use &lt;b&gt;ORDER
BY&lt;/b&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
So I don't have to be hit in the head again, I'm writing it down. 
&lt;br&gt;
&lt;br&gt;
The issue is that:&lt;br&gt;
frequently the results ARE returned in order of entry&lt;br&gt;
and 
&lt;br&gt;
frequently developers start assuming that will always be the case&lt;br&gt;
and&lt;br&gt;
frequently developers build code based on that assumption.&lt;br&gt;
&lt;br&gt;
Months go by.&lt;br&gt;
&lt;br&gt;
Then a subtle bug occasionally appears and someone spends the better part of an evening
trying to replicate the bug, and finally generates mostly, but not entirely correct
results.&amp;nbsp; By all appearances nothing is missing, but the code is angry when prodded
just so.&amp;nbsp; Running the underlying stored procedure in Query Analyzer reveals that
the records being returned are slightly out of order. The relevant SELECT statement
lacks an ORDER BY clause.&amp;nbsp; The clause is added.&amp;nbsp; The records are returned
in the expected order.&amp;nbsp; The code is happy.&amp;nbsp; The developer can go to sleep.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=e731f69b-b1ac-4779-a54c-0a662d5dd64a" /&gt;</description>
      <comments>http://www.vpsw.com/blogbaby/CommentView,guid,e731f69b-b1ac-4779-a54c-0a662d5dd64a.aspx</comments>
      <category>Annoyances</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://www.vpsw.com/blogbaby/Trackback.aspx?guid=c163aa6c-bbc2-4175-a653-00e46e2de3a1</trackback:ping>
      <pingback:server>http://www.vpsw.com/blogbaby/pingback.aspx</pingback:server>
      <pingback:target>http://www.vpsw.com/blogbaby/PermaLink,guid,c163aa6c-bbc2-4175-a653-00e46e2de3a1.aspx</pingback:target>
      <dc:creator>Dean</dc:creator>
      <wfw:comment>http://www.vpsw.com/blogbaby/CommentView,guid,c163aa6c-bbc2-4175-a653-00e46e2de3a1.aspx</wfw:comment>
      <wfw:commentRss>http://www.vpsw.com/blogbaby/SyndicationService.asmx/GetEntryCommentsRss?guid=c163aa6c-bbc2-4175-a653-00e46e2de3a1</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are four (development) life annoyances that I can do without:
</p>
        <ol>
          <li>
Recruiters who only use the state abbreviation to describe a job location. "Urgent
need for Senior .NET Developer, Location: CA"</li>
          <li>
Forum posters who demand code for entire applications. "Please send me chat server
code -- urgent."</li>
          <li>
Repeated requests for Interview Questions.  <a href="http://community.strongcoders.com/blogs/vpsw/archive/2006/10/23/the-only-interview-question-you-ll-ever-need-to-answer-click-here.aspx">I've
covered this elsewhere.</a><br /></li>
          <li>
Lazy gits who can't be bothered to learn how to read either C# or VB.NET. "Thanks
for the answer, but my project is in VB.NET, I don't understand C#."</li>
        </ol>
At least once a week, I'll answer a question on forum somewhere with a code example
and get a "Thank you, but" response.  Often accompanied by a request to rewrite
the code in their language of choice.  With perfectly named variables and smilies
in the comments.<br /><br />
This burns my toast.  It takes enormous willpower not to simply respond "find
another job you lazy git". 
<br /><br />
A) We're never talking more than 50 lines of code, usually it is around 20.  
<br />
B) 3/4 of the friggin' code is manipulating <b>.NET Framework objects</b> using <b>.NET
Framework methods</b> and <b>.NET Framework properties</b> -- which are -- wait for
it...<u><font color="#ff0000" size="4"><br /><br />
THE SAME FOR BOTH C# and VB.NET!</font></u><br /><br />
So this post is a (no longer) quick and dirty guide for figuring out how to translate
C# into VB.NET (and vice versa, but frankly 92.6% of the time its a VB coder who complains). 
It will become my standard response for all the future lazy gits.<br /><br />
Let's start at the top (of the class file that is)...<br /><br />
Need to reference a namespace...<br /><blockquote><font color="#0000ff">ala C#: using System.Data.SqlClient;</font><br /><font color="#008000">ala VB: Imports System.Data.SqlClient<br /></font><br /></blockquote>Note the ubiquitous semicolon (<b>;</b>).  C# statements can span
pages like a sentence in <a href="http://www.online-literature.com/james_joyce/ulysses/">Ulysses</a>. 
They don't end until the ; appears. VB statements get one line to do their business,
unless they are ended with the awkward _ line continuation (underscore) which allows
them to continue one more line unless they are ended with the awkward _, repeat.<br /><br />
A class...<br /><blockquote><font color="#0000ff">ala C#: public class TheClassINeverHad<br />
           {<br />
             //fields, methods and properties
-- oh my!<br />
            }<br /></font><font color="#008000">ala VB: Public Class TheClassINeverHad<br />
             'fields, methods and properties
-- oh my!<br />
          End Class<br /></font></blockquote> Ooooh no, C# does everything in lower case! (and its compiler
is very strict about keeping it that way)<br />
VB Capitalizes! (not that its compiler cares)<br /><br />
In C#, all code blocks are marked with with brackets{}. 
<br />
In VB, code blocks usually go until a line that starts with End followed by the type
of code block, which iin this case is Class.<br /><br />
Fancier class declarations...<br /><blockquote><font color="#0000ff">ala C#: public abstract class TheClassINeverHad</font><br /><font color="#008000">ala VB: Public MustInherit Class TheClassINeverHad</font><br /></blockquote><blockquote><font color="#0000ff">ala C#: public sealed class TheClassINeverHad</font><br /><font color="#008000">ala VB: Public NotInheritable Class TheClassINeverHad</font><br /></blockquote>Why VB.NET couldn't use the more common OOP vernacular is beyond me.<br /><br />
Interface declarations...<br /><blockquote><font color="#0000ff">ala C#: public interface IPractical</font><br /><font color="#008000">ala VB: Public Interface IPractical</font><br /></blockquote>Hooray, that should be clear even to the laziest git.<br /><br />
Extending a class...<br /><blockquote><font color="#0000ff">ala C#: public class TheClassINeverHad: APracticalClass</font><br /><font color="#008000">ala VB: Public Class TheClassINeverHad<br />
             Inherits APracticalClass<br /></font></blockquote>The humble colon does a lot here in C#.  The VB syntax leaves
nothing to doubt.<br /><br />
Implementing an interface...<br /><blockquote><font color="#0000ff">ala C#: public class TheClassINeverHad: IPractical</font><br /><font color="#008000">ala VB: Public Class TheClassINeverHad<br />
             Implements IPractical<br /></font></blockquote>or interfaces...<br /><blockquote><font color="#0000ff">ala C#: public class TheClassINeverHad: IPractical,
IRidiculous</font><br /><font color="#008000">ala VB: Public Class TheClassINeverHad<br />
             Implements IPractical<br />
             Implements IRidiculous<br /></font></blockquote>The colon does everything!  
<br /><br />
Extending and implementing...<br /><blockquote><font color="#0000ff">ala C#: public class TheClassINeverHad: APracticalClass,
IPractical, IRidiculous</font><br /><font color="#008000">ala VB: Public Class TheClassINeverHad<br />
             Inherits APracticalClass<br /></font><font color="#008000">             
Implements IPractical</font><br /><font color="#008000">              Implements
IRidiculous</font><br /></blockquote> A comment...<br /><blockquote><font color="#0000ff">ala C#: //This is a 1 line comment<br />
          /* This starts a multiline comment<br />
          This ends a multiline comment */<br /></font><font color="#008000">ala VB: 'This is a one line comment<br /></font></blockquote>There is no such thing as a multline comment in VB, but who comments
code anyway?<br /><br />
You really should though.<br /><br />
a field...<br /><blockquote><font color="#0000ff">ala C#: private int SomeNumberIWillUse;</font><br /><font color="#008000">ala VB: Private SomeNumberIWillUse as Integer</font><br /></blockquote> VB.NET surrounds the name of the variable with its access modifier and
type.  C# gets all that out of the way then tells you the name.<br /><br />
a constant...<br /><blockquote><font color="#0000ff">ala C#: private const string LAZY_GIT = "Lazy Git";</font><br /><font color="#008000">ala VB: Private Const LAZY_GIT as String = "Lazy Git"</font><br /></blockquote>a constructor...<br /><blockquote><font color="#0000ff">ala C#: public TheClassINeverHad()<br />
            {<br />
                //Do Something
Useful<br />
             }<br /></font><font color="#008000">ala VB: public Sub New()<br />
             'Do Something Useful<br />
          End Sub<br /></font></blockquote><font color="#008000"><br /></font>C# uses the name of the class to indicate the constructor. The Sub New in VB
is a little clearer at first blush.<br /><br />
A structure can be a handy little doo-dad when a class is overkill...<br /><blockquote><font color="#0000ff">ala C#: public struct Soda<br />
           {<br />
                 public
string Name;<br />
                 public int
Calories;<br />
            }<br /></font><font color="#008000">ala VB: Public Structure Soda<br />
             Public Name as String<br />
             Public Calories as Integer<br />
          End Structure<br /></font></blockquote> More brackets in C#, another End statement in VB. C# shows it
inclination for abbreviation. Patterns develop.<br /><br />
Let's not forget enumerations...<br /><blockquote><font color="#0000ff">ala C#: public enum PlanetValues<br />
           {<br />
                   
Mercury = 0,<br />
                   
Venus = 1,<br />
                   
Earth = 2,<br />
                   
Mars = 3,<br />
                   
Jupiter = 4,<br />
                   
Saturn = 5,<br />
                   
Uranus = 6,<br />
                   
Neptune = 7,<br />
                   
Pluto = 8<br />
            }<br /></font><font color="#0000ff">           
public enum PlanetValues<br />
           {<br />
                   
Mercury,<br />
                   
Venus,<br />
                   
Earth,<br />
                   
Mars,<br />
                   
Jupiter,<br />
                   
Saturn,<br />
                   
Uranus,<br />
                   
Neptune,<br />
                   
Pluto<br />
            }</font><br /><font color="#008000">ala VB: Public Enum PlanetValues<br />
             Mercury = 0<br />
             Venus = 1<br />
             Earth = 2<br />
             Mars = 3<br />
             Jupiter = 4<br />
             Saturn = 5<br />
             Uranus = 6<br />
             Neptune = 7<br />
             Pluto = 8<br />
          End Enum<br /><br /></font><font color="#008000">        Public Enum PlanetValues<br />
             Mercury 
<br />
             Venus 
<br />
             Earth 
<br />
             Mars 
<br />
             Jupiter 
<br />
             Saturn 
<br />
             Uranus 
<br />
             Neptune 
<br />
             Pluto 
<br />
          End Enum</font><br /></blockquote>All these enumerations are identical.  If no value for the first
element is specified it is set = 0, every other unspecified element is incremented
one from the previous element. Curiously the C# syntax uses commas and not semi-colons.<br /><br />
a local variable...<br /><blockquote><font color="#0000ff">ala C#: string DeveloperPersona;</font><br /><font color="#008000">ala VB: Dim DeveloperPersona as String</font><font color="#008000"><br /></font></blockquote>arrays...<br /><blockquote><font color="#0000ff">ala C#: string[] CoolDevTools;<br />
           string[] CoolDevTools = new string[5];<br />
           //assignment<br />
          CoolDevTools[0] = SomeString;<br /></font><font color="#008000">ala VB: Dim CoolDevTools as String()<br />
          Dim CoolDevTools(5) as String<br />
          'assignment<br />
          CoolDevTools(0) = SomeString<br />
              </font><br /></blockquote>C# uses square brackets [] for the elements.<br />
VB uses parentheses ().<br /><br />
Ditto for collection elements...<br /><blockquote><font color="#0000ff">ala C#: AnObjectType SomeObject = (</font><font color="#0000ff">AnObjectType)</font><font color="#0000ff">SomeHashtable[SomeKey];<br />
           A</font><font color="#0000ff">nObjectType
SomeObject = (</font><font color="#0000ff">AnObjectType)</font><font color="#0000ff">SomeArrayList[SomeIndex];</font><font color="#0000ff"><br /></font><font color="#008000">ala VB:  Dim SomeObject as AnObjectType = SomeHashtable(SomeKey)<br />
           </font><font color="#008000">Dim
SomeObject as AnObjectType = SomeArrayList(SomeIndex)</font><br /><font color="#008000">           'or if Option
Strict is on<br />
          D</font><font color="#008000">im SomeObject
as AnObjectType = CType(SomeHashtable(SomeKey), AnObjectType)<br />
          </font><font color="#008000">Dim SomeObject
as AnObjectType = </font><font color="#008000">CType(</font><font color="#008000">SomeArrayList(SomeIndex)</font><font color="#008000">,
AnObjectType)</font><br /><font color="#008000">               </font></blockquote>C#
doesn't do narrowing implicit type casts,  so an element retrieved from an untyped
collection must be explicitly cast.  This is done by wrapping the object type
in parentheses and smooshing it against the collection name.<br />
VB will implicitly cast unless <a href="http://msdn2.microsoft.com/en-us/library/zcd4xwzs%28vs.71%29.aspx">Option
Strict </a>is On, in which case the CType method must be used to cast the element
returned to the proper type.<br /><br />
a method that does NOT return a value...<br /><blockquote><font color="#0000ff">ala C#: public void ThePerfectMethod(string DeveloperName)<br />
             {<br />
                // coding goodness<br />
             }<br /></font><font color="#008000">ala VB: Public Sub ThePerfectMethod(DeveloperName as
String)<br />
                'Coding Goodness<br />
          End Sub<br /></font></blockquote>a method that does return a value...<br /><blockquote><font color="#0000ff">ala C#: public int ThePerfectMethod(string DeveloperName)<br />
             {<br />
                // coding goodness<br />
               
return 42;<br />
             }<br /></font><font color="#008000">ala VB: Public Function ThePerfectMethod(DeveloperName
as String) as Integer<br />
                'Coding Goodness<br />
                Return 42<br />
          End Function<br /></font></blockquote> As with fields and constants, C# states the access modifier and
the type being returned by the method before getting to the name.  When nothing
is returned the type is <b>void</b>.<br />
VB has separate keywords to differentiate between methods that return nada (Sub) and
those that return something (Function).<br />
Parameters are types just like variables are in each language:  type Name in
C#, Name as Type in VB.<br /><br />
a read/write property...<br /><blockquote><font color="#0000ff">ala C#: public int TheAnswer<br />
             {<br />
               get{  
return mTheAnswer;}<br />
               set{  mTheAnswer
= value;}<br />
             }<br /></font><font color="#008000">ala VB: Public Property TheAnswer() as Integer<br />
                Get<br />
                   
Return mTheAnswer<br />
                End Get<br />
                Set (Value
as Integer)<br />
                  
mTheAnswer = Value<br />
                End Set<br />
                  
   
<br />
          End Property</font><br /></blockquote>a read-only property...<br /><blockquote><blockquote><font color="#0000ff">ala C#: public int TheAnswer<br />
             {<br />
               get{  
return mTheAnswer;}<br />
             }<br /></font><font color="#008000">ala VB: Public ReadOnly Property TheAnswer() as Integer<br />
                Get<br />
                   
Return mTheAnswer<br />
                End Get<br />
          End Property<br /></font></blockquote></blockquote>a write-only property...<br /><blockquote><font color="#0000ff">ala C#: public int TheAnswer<br />
             {<br />
               set{  mTheAnswer
= value;}<br />
             }<br /></font><font color="#008000">ala VB: Public WriteOnly Property TheAnswer() as Integer<br />
                Set (Value
as Integer)<br />
                  
mTheAnswer = Value<br />
                End Set<br />
                  
   
<br />
          End Property</font></blockquote>VB.NET
needs to be explicity told a property is read- or write-only, C# is happy as long
as there is a get or set -- it figures it out.<br /><br />
static(Shared) members...<br /><blockquote><font color="#0000ff">ala C#: private static int mANumberEveryoneNeeds;<br />
           public static ANumberEveryoneNeeds<br />
           {<br />
                get{return </font><font color="#0000ff">mANumberEveryoneNeeds;}</font><br /><font color="#0000ff">           }<br />
           public static void ResetTheNumber()<br />
           {<br />
                </font><font color="#0000ff">mANumberEveryoneNeeds
= 0;</font><br /><font color="#0000ff">           }<br /></font><font color="#008000">ala VB: Private Shared mANumberEveryonNeeds as Integer<br />
           Public Readonly Shared Property
ANumberEveryoneNeeds() as Integer<br />
                Get<br />
                  
Return mANumberEveryoneNeeds<br />
                End Get<br />
           End Property<br />
           Public Shared Sub ResetTheNumber
()<br />
                
mANumberEveryoneNeeds = 0<br />
           End Sub<br /></font></blockquote><br />
Shared = static.  static = Shared. Static members are shared by ALL instances
of a class.  The meaning of static is not as immediately a clear as Shared. But
it's not that hard to remember.<br /><br />
Branching...<br /><blockquote><font color="#0000ff">ala C#: if(SomeVariable == 42)<br />
             {<br />
                Answer = "That's
it!";<br />
                HasWisdom = true;<br />
             }<br />
           else<br />
             {<br />
                Answer = "That's
not it.";<br />
               
HasWisdon = false;<br />
             }<br /><br />
          //one line syntax<br /></font><font color="#0000ff">           if(SomeVariable
== 42)<br />
                Answer = "That's
it!";<br />
           else<br />
                Answer = "That's
not it.";<br />
                </font><br /><font color="#0000ff"></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: If SomeVariable = 42 Then<br />
             Answer = "That's it!"<br />
             HasWisdom
= True<br />
          Else<br />
             Answer = "That's not it."<br />
             HasWisdom
= False<br />
          End if<br /></font></blockquote>There's no Then in C#, the boolean expression is wrapped in parentheses
and the code to execute is within {}. The brackets are not required if the condition
only executes one line.  Like most other constructs in VB, the code block ends
with a uniquely named End statement: End If. 
<br /><br />
Note in C# the == is an evaluation operator, as opposed to the assignment operator
=.  In VB = performs both tasks. 
<br /><br />
What fun is an If statement without boolean logic...<br /><blockquote><font color="#0000ff">ala C#: if(!Page.IsPostBack) //Not operator<br />
           </font><font color="#0000ff">if(Night
!= Day) //Inequality<br />
           </font><font color="#0000ff">if(Night
== Day &amp; Pigs.CurrentState == PigState.Flying) // And</font><br /><font color="#0000ff">           if(</font><font color="#0000ff">Night
== Day &amp;&amp; Pigs.CurrentState == PigState.Flying</font><font color="#0000ff">)
//Conditional And<br />
           </font><font color="#0000ff">if(Night
== Day | Pigs.CurrentState == PigState.Flying) // Or<br />
           </font><font color="#0000ff">if(Night
== Day || Pigs.CurrentState == PigState.Flying) // Conditional Or<br />
           </font><font color="#0000ff">if(Night
== Day ^ Pigs.CurrentState == PigState.Flying) // Xor</font><br /><br /><font color="#0000ff"><br /></font><font color="#008000">ala VB: If Not Page.IsPostBack Then<br />
           If Night &lt;&gt; Day Then 'Inequality<br />
           If Night = Day And Pigs.CurrentState
= PigState.Flying Then 
<br />
           </font><font color="#008000">If
Night = Day AndAlso Pigs.CurrentState = PigState.Flying Then 'Conditional And</font><br /><font color="#008000">           If Night
= Day Or Pigs.CurrentState = PigState.Flying Then 
<br />
           </font><font color="#008000">If
Night = Day OrElse Pigs.CurrentState = PigState.Flying Then 'Conditional Or<br />
           </font><font color="#008000">If
Night = Day Xor Pigs.CurrentState = PigState.Flying Then</font><br /><font color="#008000">            
<br /></font></blockquote>VB spells everything out, though &lt;&gt; is a unique feature
of the language.  The conditional operators AndAlso (&amp;&amp;) and OrElse(||)
are tres useful, they short circuit the code and stop evaluting as soon as the appropriate
condition is met. 
<br /><br />
And when If Then is isn't enough...<br /><blockquote><font color="#0000ff">ala C#: </font><font color="#0000ff">switch(SelectedPlanet)</font><br /><font color="#0000ff">            {<br />
                 case
PlanetValues.Earth:<br />
                     
message = "Live there";<br />
                     
break;<br />
                 case
PlanetValues.Venus:<br />
                 case
PlanetValues.Mars:<br />
                  
   message = "Landed there";<br />
                  
   break;<br />
                 </font><font color="#0000ff">case
PlanetValues.Mercury:<br />
                 case
PlanetValues.Jupiter:<br />
                 case
PlanetValues.Saturn:<br />
                 case
PlanetValues.Uranus:<br />
                 case
PlanetValues.Neptune:<br />
                  
   message = "Flew by";<br />
                  
   break;<br />
                  case
PlanetValues.Pluto:<br />
                  
   message = "Is it a planet?"<br />
                  
   break;<br />
                  
default:<br />
                  
   message = "Never heard of it";<br />
                  
   break;<br />
           }</font><font color="#0000ff"><br />
            </font><font color="#0000ff"><br /></font><font color="#008000">ala VB: Select Case SelectedPlanet<br />
                Case PlanetValues.Earth<br />
                  
message = "Live there"<br />
                Case PlanetValues.Venus,
PlanetValues.Mars<br />
                  
message = "Landed there"<br />
                Case PlanetValues.Mercury,
PlanetValues.Jupiter, PlanetValues.Saturn, PlanetValues.Uranus, PlanetValues.Neptune<br />
                  
message = "Flew by"<br />
                Case PlanetValues.Pluto<br />
                  
message = "Is it a planet?"<br />
                Case Else<br />
                  
message = "Never heard of it"<br />
          End Select</font><font color="#008000"></font><br /></blockquote>In C#, there's only one value per case, but once a supplied value matches
a case, the code will "fall through" until it finds a case that executes code. 
All cases that have code must end with a break;. 
<br />
In VB, multiple values can be present on a line, it's also possible to do <a href="http://msdn2.microsoft.com/en-us/library/cy37t14y%28VS.71%29.aspx">ranges.</a> The
code cannot fall through in VB, but the extra flexibility for defining case values
makes it unecessary. 
<br /><br />
For Loops...<br /><blockquote><font color="#0000ff">ala C#: for(int Index = 0; Index &lt; SomeIntegerArray.Length;
Index ++)<br />
             {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 CallSomeOtherFunction(SomeIntegerArray[Index]);<br />
             }<br />
             //A single line For Loop
can be done without the brackets<br />
            </font><font color="#0000ff">for(int
Index = 0; Index &lt; SomeIntegerArray.Length; Index ++)<br />
                </font><font color="#0000ff">Total
+= SomeIntegerArray[Index];<br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1<br />
                Total += SomeIntegerArray(Index)<br />
                CallSomeOtherFunction(SomeIntegerArray(Index))<br />
          Next</font></blockquote><br />
In C#, {} brackets define what code gets looped, but a single line statement does
not require brackets. Iteration step size is always specified<br />
VB always requires the Next statement.  The iteration step size defaults to 1
for VB, to change the iteration step size...<br /><br /><blockquote><font color="#0000ff">ala C#: for(int Index = 0; Index &lt; SomeIntegerArray.Length;
Index += 2)<br />
             {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 CallSomeOtherFunction(SomeIntegerArray[Index]);<br />
             }<br />
            </font><font color="#0000ff"><br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1 Step 2<br />
                Total += SomeIntegerArray(Index)<br />
                </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))</font><br /><font color="#008000">           Next</font></blockquote>To
break out of the loop before it completes...<br /><blockquote><font color="#0000ff">ala C#: for(int Index = 0; Index &lt; SomeIntegerArray.Length;
Index += 2)<br />
             {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)<br />
                  
break;<br />
             }</font><font color="#0000ff"><br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1 Step 2<br />
                Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit For<br />
                End if<br /></font><font color="#008000">           Next</font></blockquote>break
is used to get out of every kind of loop in C#.  The command for exiting a loop
in VB.NET depends on the type of the loop. This can come in handy for nested loops
of different types.<br /><br />
For each loops...<br /><br /><blockquote><font color="#0000ff">ala C#: foreach(Universe PossibleUniverse in PossibleUniverses)<br />
             {<br />
                 if(PossibleUniverse.HasStrongForce)<br />
                 {<br />
                  
   
<br />
                  
   AddToViableCandidates(PossibleUniverse);<br />
                 }<br />
             }<br />
            </font><font color="#0000ff"><br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: For Each PossibleUniverse as Universe in PossibleUniverses 
<br />
                If PossibleUniverse.HasStrongForce
Then<br />
                  
AddToViableCandidates(PossibleUniverse)<br />
                End if<br />
          Next<br /><br /></font></blockquote>Ignore the brackets and the for each loops look a lot alike.<br /><br /><br />
Do While Loops...<br /><blockquote><font color="#0000ff">ala C#: do<br />
             {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)<br />
                  
break;<br />
                 Index++;<br />
             }<br />
             while(Index &lt; SomeIntegerArray.Length);<br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: Do<br />
                Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit Do<br />
                End if<br />
               
Index += 1<br /></font><font color="#008000">           Loop While
Index &lt; SomeIntegerArray.Length<br /><br /></font><font color="#008000">          Do </font><font color="#008000">While
Index &lt; SomeIntegerArray.Length</font><br /><font color="#008000">                
Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit Do<br />
                End if<br />
                Index += 1<br /></font><font color="#008000">           Loop </font><br /></blockquote><br />
The do loop in C# always executes at least once.  The top version of the VB loop
does as well.  While the second version evaluates the condition before executing.
This is the one of the few code structures in VB that doesn't denote it's end using
an End statement (the others being the for and for each loops). If it did it would
look something like this...<br /><font color="#ff1493"><br />
          'This is not legal syntax -- just what
a Do loop would look like if VB were maddeningly consistent<br />
          Do<br />
                Total +=SomeIntegerArray(Index)<br />
          End Do While Index &lt; SomeIntegerArray.Length<br /></font><br />
Which is just goofy.<br /><br />
Do Until Loops...<br /><blockquote><font color="#0000ff">ala C#: do<br />
             {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)<br />
                  
break;<br />
                 Index++;<br />
             }<br />
             while(Index &lt; SomeIntegerArray.Length);<br /></font><font color="#0000ff"><br /></font><font color="#008000">ala VB: Do<br />
                Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit Do<br />
                End if<br />
                Index += 1<br /></font><font color="#008000">           Loop Until
Index = SomeIntegerArray.Length<br /><br /></font><font color="#008000">          Do </font><font color="#008000">Until
Index = SomeIntegerArray.Length</font><br /><font color="#008000">                
Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit Do<br />
                End if<br />
                Index += 1<br /></font><font color="#008000">           Loop </font><br /></blockquote><br />
Wait a second -- there's no <b>do until</b> in C#. <b>Until</b> is just the other
side of <b>while</b>.  Instead of executing <b>while</b> a condition is true,
it executes <b>until</b> it is true. When moving from VB.NET to C# just use the while
and flip the condition to its opposite. Again the C# loop and the first VB loop execute
at least once.  
<br /><br />
And the last loop is the plain old while loop...<br /><blockquote><font color="#0000ff">ala C#: </font><font color="#0000ff">while(Index
&lt; SomeIntegerArray.Length)</font><br /><font color="#0000ff">              {<br />
                 Total
+= SomeIntegerArray[Index];<br />
                 if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)<br />
                  
break;<br />
                 Index++;<br />
             }<br />
            </font><font color="#0000ff"><br /></font><font color="#008000">ala VB: While </font><font color="#008000">Index &lt;
SomeIntegerArray.Length<br /></font><br /><font color="#008000">                
Total += SomeIntegerArray(Index)<br />
                If </font><font color="#008000">CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then<br />
                  
Exit While<br />
                End if<br />
                Index += 1<br /></font><font color="#008000">           End 
While 
<br /></font><font color="#008000">         </font><font color="#008000"></font><br /></blockquote> While loops in both languages evaluate the condition before executing. 
Note the while uses the familiar Exit While to break and the End While to terminate
the loop.<br /><br />
Finally, a tricky difference -- hooking up event handlers...<br /><blockquote><font color="#0000ff">ala C#: </font><font color="#0000ff">SomeButton.Click
+= new ButtonEventHandler(SomeButton_Click);</font><font color="#0000ff"></font><br /><font color="#0000ff">             </font><br /><font color="#008000">ala VB: AddHandler SomeButton.Click, AddressOf SomeButton_Click</font><br /><br /><font color="#008000">          'or directly declare
it</font><br /><font color="#008000">           Sub SomeButton_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles SomeButton.Click</font><br /></blockquote>VB lets you hook up the Handler on the event declaration or add the handler
dynamically.  C# only allows the dynamic hook.  
<br /><br />
I think this post has sufficiently covered 93.7% of commonly encountered code. 
I'd cover <a href="http://msdn2.microsoft.com/en-us/library/512aeb7t.aspx">Generics</a> (<a href="http://msdn2.microsoft.com/en-us/library/ms379608%28vs.80%29.aspx">VB
usage)</a>  but I think anyone working with Generics probably doesn't have any
problems reading either language.<br /><br />
Here are some reference links...<br /><ul><li><a href="http://msdn2.microsoft.com/en-us/library/6a71f45d.aspx">C# Operators</a></li><li><a href="http://msdn2.microsoft.com/en-us/library/x53a06bb.aspx">C# Keywords</a></li><li><a href="http://msdn2.microsoft.com/en-us/library/ksh7h19t%28VS.71%29.aspx">VB.NET
Keywords</a></li><li><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp">Language
Equivalents</a></li></ul>
And for the truly lazy or people who have to translate more than 20 lines of code,
there are converters (though you might get some <a href="http://www.vpsw.com/blogbaby/PermaLink,guid,bb634e82-a78f-4fca-9d5d-a63616d70f99.aspx">interesting
results</a>) ...<br /><ul><li><a href="http://www.tangiblesoftwaresolutions.com/">Tanglible Software</a></li><li><a href="http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx">Developer
Fusion</a></li><li><a href="http://www.google.com/search?q=c%23+vb+converter&amp;sourceid=navclient-ff&amp;ie=UTF-8&amp;rlz=1B3GGGL_enUS176US213&amp;aq=t">Or
Google For More</a></li></ul>
So learn 'em both -- double your code examples, double your employment opportunities
-- double your fun.<br /><img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=c163aa6c-bbc2-4175-a653-00e46e2de3a1" /></body>
      <title>Airing of Grievances</title>
      <guid isPermaLink="false">http://www.vpsw.com/blogbaby/PermaLink,guid,c163aa6c-bbc2-4175-a653-00e46e2de3a1.aspx</guid>
      <link>http://www.vpsw.com/blogbaby/PermaLink,guid,c163aa6c-bbc2-4175-a653-00e46e2de3a1.aspx</link>
      <pubDate>Fri, 30 Mar 2007 22:12:15 GMT</pubDate>
      <description>&lt;p&gt;
There are four (development) life annoyances that I can do without:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Recruiters who only use the state abbreviation to describe a job location. "Urgent
need for Senior .NET Developer, Location: CA"&lt;/li&gt;
&lt;li&gt;
Forum posters who demand code for entire applications. "Please send me chat server
code -- urgent."&lt;/li&gt;
&lt;li&gt;
Repeated requests for Interview Questions.&amp;nbsp; &lt;a href="http://community.strongcoders.com/blogs/vpsw/archive/2006/10/23/the-only-interview-question-you-ll-ever-need-to-answer-click-here.aspx"&gt;I've
covered this elsewhere.&lt;/a&gt;
&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
Lazy gits who can't be bothered to learn how to read either C# or VB.NET. "Thanks
for the answer, but my project is in VB.NET, I don't understand C#."&lt;/li&gt;
&lt;/ol&gt;
At least once a week, I'll answer a question on forum somewhere with a code example
and get a "Thank you, but" response.&amp;nbsp; Often accompanied by a request to rewrite
the code in their language of choice.&amp;nbsp; With perfectly named variables and smilies
in the comments.&lt;br&gt;
&lt;br&gt;
This burns my toast.&amp;nbsp; It takes enormous willpower not to simply respond "find
another job you lazy git". 
&lt;br&gt;
&lt;br&gt;
A) We're never talking more than 50 lines of code, usually it is around 20.&amp;nbsp; 
&lt;br&gt;
B) 3/4 of the friggin' code is manipulating &lt;b&gt;.NET Framework objects&lt;/b&gt; using &lt;b&gt;.NET
Framework methods&lt;/b&gt; and &lt;b&gt;.NET Framework properties&lt;/b&gt; -- which are -- wait for
it...&lt;u&gt;&lt;font color="#ff0000" size="4"&gt;
&lt;br&gt;
&lt;br&gt;
THE SAME FOR BOTH C# and VB.NET!&lt;/font&gt;&lt;/u&gt;
&lt;br&gt;
&lt;br&gt;
So this post is a (no longer) quick and dirty guide for figuring out how to translate
C# into VB.NET (and vice versa, but frankly 92.6% of the time its a VB coder who complains).&amp;nbsp;
It will become my standard response for all the future lazy gits.&lt;br&gt;
&lt;br&gt;
Let's start at the top (of the class file that is)...&lt;br&gt;
&lt;br&gt;
Need to reference a namespace...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: using System.Data.SqlClient;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Imports System.Data.SqlClient&lt;br&gt;
&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;Note the ubiquitous semicolon (&lt;b&gt;;&lt;/b&gt;).&amp;nbsp; C# statements can span
pages like a sentence in &lt;a href="http://www.online-literature.com/james_joyce/ulysses/"&gt;Ulysses&lt;/a&gt;.&amp;nbsp;
They don't end until the ; appears. VB statements get one line to do their business,
unless they are ended with the awkward _ line continuation (underscore) which allows
them to continue one more line unless they are ended with the awkward _, repeat.&lt;br&gt;
&lt;br&gt;
A class...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //fields, methods and properties
-- oh my!&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public Class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'fields, methods and properties
-- oh my!&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Class&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt; Ooooh no, C# does everything in lower case! (and its compiler
is very strict about keeping it that way)&lt;br&gt;
VB Capitalizes! (not that its compiler cares)&lt;br&gt;
&lt;br&gt;
In C#, all code blocks are marked with with brackets{}. 
&lt;br&gt;
In VB, code blocks usually go until a line that starts with End followed by the type
of code block, which iin this case is Class.&lt;br&gt;
&lt;br&gt;
Fancier class declarations...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public abstract class TheClassINeverHad&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public MustInherit Class TheClassINeverHad&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt; &lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public sealed class TheClassINeverHad&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public NotInheritable Class TheClassINeverHad&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;Why VB.NET couldn't use the more common OOP vernacular is beyond me.&lt;br&gt;
&lt;br&gt;
Interface declarations...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public interface IPractical&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Interface IPractical&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;Hooray, that should be clear even to the laziest git.&lt;br&gt;
&lt;br&gt;
Extending a class...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public class TheClassINeverHad: APracticalClass&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Inherits APracticalClass&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;The humble colon does a lot here in C#.&amp;nbsp; The VB syntax leaves
nothing to doubt.&lt;br&gt;
&lt;br&gt;
Implementing an interface...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public class TheClassINeverHad: IPractical&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Implements IPractical&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;or interfaces...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public class TheClassINeverHad: IPractical,
IRidiculous&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Implements IPractical&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Implements IRidiculous&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;The colon does everything!&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
Extending and implementing...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public class TheClassINeverHad: APracticalClass,
IPractical, IRidiculous&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Class TheClassINeverHad&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Inherits APracticalClass&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;
Implements IPractical&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Implements
IRidiculous&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt; A comment...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: //This is a 1 line comment&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* This starts a multiline comment&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; This ends a multiline comment */&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: 'This is a one line comment&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;There is no such thing as a multline comment in VB, but who comments
code anyway?&lt;br&gt;
&lt;br&gt;
You really should though.&lt;br&gt;
&lt;br&gt;
a field...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: private int SomeNumberIWillUse;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Private SomeNumberIWillUse as Integer&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt; VB.NET surrounds the name of the variable with its access modifier and
type.&amp;nbsp; C# gets all that out of the way then tells you the name.&lt;br&gt;
&lt;br&gt;
a constant...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: private const string LAZY_GIT = "Lazy Git";&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Private Const LAZY_GIT as String = "Lazy Git"&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;a constructor...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public TheClassINeverHad()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&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; //Do Something
Useful&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: public Sub New()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'Do Something Useful&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Sub&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt; &lt;font color="#008000"&gt;
&lt;br&gt;
&lt;/font&gt;C# uses the name of the class to indicate the constructor. The Sub New in VB
is a little clearer at first blush.&lt;br&gt;
&lt;br&gt;
A structure can be a handy little doo-dad when a class is overkill...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public struct Soda&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;nbsp; public
string Name;&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; public int
Calories;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public Structure Soda&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Public Name as String&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Public Calories as Integer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Structure&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt; More brackets in C#, another End statement in VB. C# shows it
inclination for abbreviation. Patterns develop.&lt;br&gt;
&lt;br&gt;
Let's not forget enumerations...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public enum PlanetValues&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;nbsp; &amp;nbsp;&amp;nbsp;
Mercury = 0,&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;nbsp;&amp;nbsp;&amp;nbsp;
Venus = 1,&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;nbsp;&amp;nbsp;&amp;nbsp;
Earth = 2,&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;nbsp;&amp;nbsp;&amp;nbsp;
Mars = 3,&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;nbsp;&amp;nbsp;&amp;nbsp;
Jupiter = 4,&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;nbsp;&amp;nbsp;&amp;nbsp;
Saturn = 5,&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;nbsp;&amp;nbsp;&amp;nbsp;
Uranus = 6,&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;nbsp;&amp;nbsp;&amp;nbsp;
Neptune = 7,&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;nbsp;&amp;nbsp;&amp;nbsp;
Pluto = 8&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
public enum PlanetValues&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;nbsp; &amp;nbsp;&amp;nbsp;
Mercury,&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;nbsp;&amp;nbsp;&amp;nbsp;
Venus,&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;nbsp;&amp;nbsp;&amp;nbsp;
Earth,&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;nbsp;&amp;nbsp;&amp;nbsp;
Mars,&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;nbsp;&amp;nbsp;&amp;nbsp;
Jupiter,&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;nbsp;&amp;nbsp;&amp;nbsp;
Saturn,&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;nbsp;&amp;nbsp;&amp;nbsp;
Uranus,&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;nbsp;&amp;nbsp;&amp;nbsp;
Neptune,&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;nbsp;&amp;nbsp;&amp;nbsp;
Pluto&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Public Enum PlanetValues&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Mercury = 0&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Venus = 1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Earth = 2&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Mars = 3&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Jupiter = 4&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Saturn = 5&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Uranus = 6&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Neptune = 7&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Pluto = 8&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Enum&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public Enum PlanetValues&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Mercury 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Venus 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Earth 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Mars 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Jupiter 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Saturn 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Uranus 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Neptune 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Pluto 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Enum&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;All these enumerations are identical.&amp;nbsp; If no value for the first
element is specified it is set = 0, every other unspecified element is incremented
one from the previous element. Curiously the C# syntax uses commas and not semi-colons.&lt;br&gt;
&lt;br&gt;
a local variable...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: string DeveloperPersona;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: Dim DeveloperPersona as String&lt;/font&gt;&lt;font color="#008000"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;arrays...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: string[] CoolDevTools;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string[] CoolDevTools = new string[5];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //assignment&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; CoolDevTools[0] = SomeString;&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Dim CoolDevTools as String()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Dim CoolDevTools(5) as String&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'assignment&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; CoolDevTools(0) = SomeString&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;C# uses square brackets [] for the elements.&lt;br&gt;
VB uses parentheses ().&lt;br&gt;
&lt;br&gt;
Ditto for collection elements...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: AnObjectType SomeObject = (&lt;/font&gt;&lt;font color="#0000ff"&gt;AnObjectType)&lt;/font&gt;&lt;font color="#0000ff"&gt;SomeHashtable[SomeKey];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; A&lt;/font&gt;&lt;font color="#0000ff"&gt;nObjectType
SomeObject = (&lt;/font&gt;&lt;font color="#0000ff"&gt;AnObjectType)&lt;/font&gt;&lt;font color="#0000ff"&gt;SomeArrayList[SomeIndex];&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB:&amp;nbsp; Dim SomeObject as AnObjectType = SomeHashtable(SomeKey)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;Dim
SomeObject as AnObjectType = SomeArrayList(SomeIndex)&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'or if Option
Strict is on&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; D&lt;/font&gt;&lt;font color="#008000"&gt;im SomeObject
as AnObjectType = CType(SomeHashtable(SomeKey), AnObjectType)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;Dim SomeObject
as AnObjectType = &lt;/font&gt;&lt;font color="#008000"&gt;CType(&lt;/font&gt;&lt;font color="#008000"&gt;SomeArrayList(SomeIndex)&lt;/font&gt;&lt;font color="#008000"&gt;,
AnObjectType)&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/blockquote&gt;C#
doesn't do narrowing implicit type casts,&amp;nbsp; so an element retrieved from an untyped
collection must be explicitly cast.&amp;nbsp; This is done by wrapping the object type
in parentheses and smooshing it against the collection name.&lt;br&gt;
VB will implicitly cast unless &lt;a href="http://msdn2.microsoft.com/en-us/library/zcd4xwzs%28vs.71%29.aspx"&gt;Option
Strict &lt;/a&gt;is On, in which case the CType method must be used to cast the element
returned to the proper type.&lt;br&gt;
&lt;br&gt;
a method that does NOT return a value...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public void ThePerfectMethod(string DeveloperName)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; // coding goodness&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public Sub ThePerfectMethod(DeveloperName as
String)&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; 'Coding Goodness&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Sub&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;a method that does return a value...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public int ThePerfectMethod(string DeveloperName)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; // coding goodness&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
return 42;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public Function ThePerfectMethod(DeveloperName
as String) as Integer&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; 'Coding Goodness&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; Return 42&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Function&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt; As with fields and constants, C# states the access modifier and
the type being returned by the method before getting to the name.&amp;nbsp; When nothing
is returned the type is &lt;b&gt;void&lt;/b&gt;.&lt;br&gt;
VB has separate keywords to differentiate between methods that return nada (Sub) and
those that return something (Function).&lt;br&gt;
Parameters are types just like variables are in each language:&amp;nbsp; type Name in
C#, Name as Type in VB.&lt;br&gt;
&lt;br&gt;
a read/write property...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public int TheAnswer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; get{&amp;nbsp;&amp;nbsp;
return mTheAnswer;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; set{&amp;nbsp; mTheAnswer
= value;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public Property TheAnswer() as Integer&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; Get&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;nbsp;&amp;nbsp;&amp;nbsp;
Return mTheAnswer&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; End Get&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; Set (Value
as Integer)&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;nbsp;&amp;nbsp;
mTheAnswer = Value&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; End Set&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Property&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;a read-only property...&lt;br&gt;
&lt;blockquote&gt;&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public int TheAnswer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; get{&amp;nbsp;&amp;nbsp;
return mTheAnswer;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public ReadOnly Property TheAnswer() as Integer&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; Get&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;nbsp;&amp;nbsp;&amp;nbsp;
Return mTheAnswer&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; End Get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Property&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;a write-only property...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: public int TheAnswer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; set{&amp;nbsp; mTheAnswer
= value;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Public WriteOnly Property TheAnswer() as Integer&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; Set (Value
as Integer)&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;nbsp;&amp;nbsp;
mTheAnswer = Value&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; End Set&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Property&lt;/font&gt;&lt;/blockquote&gt;VB.NET
needs to be explicity told a property is read- or write-only, C# is happy as long
as there is a get or set -- it figures it out.&lt;br&gt;
&lt;br&gt;
static(Shared) members...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: private static int mANumberEveryoneNeeds;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public static ANumberEveryoneNeeds&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&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; get{return &lt;/font&gt;&lt;font color="#0000ff"&gt;mANumberEveryoneNeeds;}&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&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; public static void ResetTheNumber()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&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; &lt;/font&gt;&lt;font color="#0000ff"&gt;mANumberEveryoneNeeds
= 0;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt;ala VB: Private Shared mANumberEveryonNeeds as Integer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public Readonly Shared Property
ANumberEveryoneNeeds() as Integer&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; Get&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;nbsp;&amp;nbsp;
Return mANumberEveryoneNeeds&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; End Get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public Shared Sub ResetTheNumber
()&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;nbsp;&amp;nbsp;
mANumberEveryoneNeeds = 0&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;
&lt;br&gt;
Shared = static.&amp;nbsp; static = Shared. Static members are shared by ALL instances
of a class.&amp;nbsp; The meaning of static is not as immediately a clear as Shared. But
it's not that hard to remember.&lt;br&gt;
&lt;br&gt;
Branching...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: if(SomeVariable == 42)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; Answer = "That's
it!";&lt;br&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; HasWisdom = true;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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; Answer = "That's
not it.";&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
HasWisdon = false;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //one line syntax&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; if(SomeVariable
== 42)&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; Answer = "That's
it!";&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else&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; Answer = "That's
not it.";&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: If SomeVariable = 42 Then&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Answer = "That's it!"&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;nbsp; HasWisdom
= True&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Answer = "That's not it."&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;nbsp; HasWisdom
= False&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End if&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;There's no Then in C#, the boolean expression is wrapped in parentheses
and the code to execute is within {}. The brackets are not required if the condition
only executes one line.&amp;nbsp; Like most other constructs in VB, the code block ends
with a uniquely named End statement: End If. 
&lt;br&gt;
&lt;br&gt;
Note in C# the == is an evaluation operator, as opposed to the assignment operator
=.&amp;nbsp; In VB = performs both tasks. 
&lt;br&gt;
&lt;br&gt;
What fun is an If statement without boolean logic...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: if(!Page.IsPostBack) //Not operator&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;if(Night
!= Day) //Inequality&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;if(Night
== Day &amp;amp; Pigs.CurrentState == PigState.Flying) // And&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; if(&lt;/font&gt;&lt;font color="#0000ff"&gt;Night
== Day &amp;amp;&amp;amp; Pigs.CurrentState == PigState.Flying&lt;/font&gt;&lt;font color="#0000ff"&gt;)
//Conditional And&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;if(Night
== Day | Pigs.CurrentState == PigState.Flying) // Or&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;if(Night
== Day || Pigs.CurrentState == PigState.Flying) // Conditional Or&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;if(Night
== Day ^ Pigs.CurrentState == PigState.Flying) // Xor&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: If Not Page.IsPostBack Then&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; If Night &amp;lt;&amp;gt; Day Then 'Inequality&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Night = Day And Pigs.CurrentState
= PigState.Flying Then 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;If
Night = Day AndAlso Pigs.CurrentState = PigState.Flying Then 'Conditional And&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; If Night
= Day Or Pigs.CurrentState = PigState.Flying Then 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;If
Night = Day OrElse Pigs.CurrentState = PigState.Flying Then 'Conditional Or&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;If
Night = Day Xor Pigs.CurrentState = PigState.Flying Then&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;VB spells everything out, though &amp;lt;&amp;gt; is a unique feature
of the language.&amp;nbsp; The conditional operators AndAlso (&amp;amp;&amp;amp;) and OrElse(||)
are tres useful, they short circuit the code and stop evaluting as soon as the appropriate
condition is met. 
&lt;br&gt;
&lt;br&gt;
And when If Then is isn't enough...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: &lt;/font&gt;&lt;font color="#0000ff"&gt;switch(SelectedPlanet)&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&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;nbsp; case
PlanetValues.Earth:&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
message = "Live there";&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
break;&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;nbsp; case
PlanetValues.Venus:&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;nbsp; case
PlanetValues.Mars:&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; message = "Landed there";&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; break;&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;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;case
PlanetValues.Mercury:&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;nbsp; case
PlanetValues.Jupiter:&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;nbsp; case
PlanetValues.Saturn:&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;nbsp; case
PlanetValues.Uranus:&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;nbsp; case
PlanetValues.Neptune:&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; message = "Flew by";&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; break;&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;nbsp; case
PlanetValues.Pluto:&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; message = "Is it a planet?"&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; break;&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;nbsp;&amp;nbsp;
default:&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; message = "Never heard of it";&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; break;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Select Case SelectedPlanet&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; Case PlanetValues.Earth&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;nbsp;&amp;nbsp;
message = "Live there"&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; Case PlanetValues.Venus,
PlanetValues.Mars&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;nbsp;&amp;nbsp;
message = "Landed there"&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; Case PlanetValues.Mercury,
PlanetValues.Jupiter, PlanetValues.Saturn, PlanetValues.Uranus, PlanetValues.Neptune&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;nbsp;&amp;nbsp;
message = "Flew by"&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; Case PlanetValues.Pluto&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;nbsp;&amp;nbsp;
message = "Is it a planet?"&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; Case Else&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;nbsp;&amp;nbsp;
message = "Never heard of it"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End Select&lt;/font&gt;&lt;font color="#008000"&gt;&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;In C#, there's only one value per case, but once a supplied value matches
a case, the code will "fall through" until it finds a case that executes code.&amp;nbsp;
All cases that have code must end with a break;. 
&lt;br&gt;
In VB, multiple values can be present on a line, it's also possible to do &lt;a href="http://msdn2.microsoft.com/en-us/library/cy37t14y%28VS.71%29.aspx"&gt;ranges.&lt;/a&gt; The
code cannot fall through in VB, but the extra flexibility for defining case values
makes it unecessary. 
&lt;br&gt;
&lt;br&gt;
For Loops...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: for(int Index = 0; Index &amp;lt; SomeIntegerArray.Length;
Index ++)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; CallSomeOtherFunction(SomeIntegerArray[Index]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //A single line For Loop
can be done without the brackets&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; &lt;/font&gt;&lt;font color="#0000ff"&gt;for(int
Index = 0; Index &amp;lt; SomeIntegerArray.Length; Index ++)&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; &lt;/font&gt;&lt;font color="#0000ff"&gt;Total
+= SomeIntegerArray[Index];&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1&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; Total += SomeIntegerArray(Index)&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; CallSomeOtherFunction(SomeIntegerArray(Index))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Next&lt;/font&gt;&lt;/blockquote&gt;
&lt;br&gt;
In C#, {} brackets define what code gets looped, but a single line statement does
not require brackets. Iteration step size is always specified&lt;br&gt;
VB always requires the Next statement.&amp;nbsp; The iteration step size defaults to 1
for VB, to change the iteration step size...&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: for(int Index = 0; Index &amp;lt; SomeIntegerArray.Length;
Index += 2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; CallSomeOtherFunction(SomeIntegerArray[Index]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1 Step 2&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; Total += SomeIntegerArray(Index)&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; &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Next&lt;/font&gt;&lt;/blockquote&gt;To
break out of the loop before it completes...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: for(int Index = 0; Index &amp;lt; SomeIntegerArray.Length;
Index += 2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)&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;nbsp;&amp;nbsp;
break;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: For Index as Integer = 0 to SomeIntegerArray.Length
-1 Step 2&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; Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit For&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; End if&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Next&lt;/font&gt;&lt;/blockquote&gt;break
is used to get out of every kind of loop in C#.&amp;nbsp; The command for exiting a loop
in VB.NET depends on the type of the loop. This can come in handy for nested loops
of different types.&lt;br&gt;
&lt;br&gt;
For each loops...&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: foreach(Universe PossibleUniverse in PossibleUniverses)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; if(PossibleUniverse.HasStrongForce)&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;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;nbsp;&amp;nbsp;
&amp;nbsp;&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;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; AddToViableCandidates(PossibleUniverse);&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;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: For Each PossibleUniverse as Universe in PossibleUniverses 
&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; If PossibleUniverse.HasStrongForce
Then&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;nbsp;&amp;nbsp;
AddToViableCandidates(PossibleUniverse)&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; End if&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Next&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;Ignore the brackets and the for each loops look a lot alike.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Do While Loops...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: do&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)&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;nbsp;&amp;nbsp;
break;&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;nbsp; Index++;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; while(Index &amp;lt; SomeIntegerArray.Length);&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Do&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; Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit Do&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; End if&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Index += 1&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Loop While
Index &amp;lt; SomeIntegerArray.Length&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Do &lt;/font&gt;&lt;font color="#008000"&gt;While
Index &amp;lt; SomeIntegerArray.Length&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;
Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit Do&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; End if&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; Index += 1&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Loop &lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
The do loop in C# always executes at least once.&amp;nbsp; The top version of the VB loop
does as well.&amp;nbsp; While the second version evaluates the condition before executing.
This is the one of the few code structures in VB that doesn't denote it's end using
an End statement (the others being the for and for each loops). If it did it would
look something like this...&lt;br&gt;
&lt;font color="#ff1493"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'This is not legal syntax -- just what
a Do loop would look like if VB were maddeningly consistent&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do&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; Total +=SomeIntegerArray(Index)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Do While Index &amp;lt; SomeIntegerArray.Length&lt;br&gt;
&lt;/font&gt;
&lt;br&gt;
Which is just goofy.&lt;br&gt;
&lt;br&gt;
Do Until Loops...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: do&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)&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;nbsp;&amp;nbsp;
break;&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;nbsp; Index++;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; while(Index &amp;lt; SomeIntegerArray.Length);&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: Do&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; Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit Do&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; End if&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; Index += 1&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Loop Until
Index = SomeIntegerArray.Length&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Do &lt;/font&gt;&lt;font color="#008000"&gt;Until
Index = SomeIntegerArray.Length&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;
Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit Do&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; End if&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; Index += 1&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Loop &lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt; 
&lt;br&gt;
Wait a second -- there's no &lt;b&gt;do until&lt;/b&gt; in C#. &lt;b&gt;Until&lt;/b&gt; is just the other
side of &lt;b&gt;while&lt;/b&gt;.&amp;nbsp; Instead of executing &lt;b&gt;while&lt;/b&gt; a condition is true,
it executes &lt;b&gt;until&lt;/b&gt; it is true. When moving from VB.NET to C# just use the while
and flip the condition to its opposite. Again the C# loop and the first VB loop execute
at least once.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
And the last loop is the plain old while loop...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: &lt;/font&gt;&lt;font color="#0000ff"&gt;while(Index
&amp;lt; SomeIntegerArray.Length)&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&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;nbsp; Total
+= SomeIntegerArray[Index];&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;nbsp; if(CallSomeOtherFunction(SomeIntegerArray[Index])
== false)&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;nbsp;&amp;nbsp;
break;&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;nbsp; Index++;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;ala VB: While &lt;/font&gt;&lt;font color="#008000"&gt;Index &amp;lt;
SomeIntegerArray.Length&lt;br&gt;
&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;
Total += SomeIntegerArray(Index)&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; If &lt;/font&gt;&lt;font color="#008000"&gt;CallSomeOtherFunction(SomeIntegerArray(Index))
= False Then&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;nbsp;&amp;nbsp;
Exit While&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; End if&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; Index += 1&lt;br&gt;
&lt;/font&gt; &lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; End&amp;nbsp;
While 
&lt;br&gt;
&lt;/font&gt;&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#008000"&gt;&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt; While loops in both languages evaluate the condition before executing.&amp;nbsp;
Note the while uses the familiar Exit While to break and the End While to terminate
the loop.&lt;br&gt;
&lt;br&gt;
Finally, a tricky difference -- hooking up event handlers...&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#0000ff"&gt;ala C#: &lt;/font&gt;&lt;font color="#0000ff"&gt;SomeButton.Click
+= new ButtonEventHandler(SomeButton_Click);&lt;/font&gt;&lt;font color="#0000ff"&gt;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;ala VB: AddHandler SomeButton.Click, AddressOf SomeButton_Click&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'or directly declare
it&lt;/font&gt;
&lt;br&gt;
&lt;font color="#008000"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Sub SomeButton_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles SomeButton.Click&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;VB lets you hook up the Handler on the event declaration or add the handler
dynamically.&amp;nbsp; C# only allows the dynamic hook.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
I think this post has sufficiently covered 93.7% of commonly encountered code.&amp;nbsp;
I'd cover &lt;a href="http://msdn2.microsoft.com/en-us/library/512aeb7t.aspx"&gt;Generics&lt;/a&gt; (&lt;a href="http://msdn2.microsoft.com/en-us/library/ms379608%28vs.80%29.aspx"&gt;VB
usage)&lt;/a&gt;&amp;nbsp; but I think anyone working with Generics probably doesn't have any
problems reading either language.&lt;br&gt;
&lt;br&gt;
Here are some reference links...&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/6a71f45d.aspx"&gt;C# Operators&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/x53a06bb.aspx"&gt;C# Keywords&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/ksh7h19t%28VS.71%29.aspx"&gt;VB.NET
Keywords&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp"&gt;Language
Equivalents&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
And for the truly lazy or people who have to translate more than 20 lines of code,
there are converters (though you might get some &lt;a href="http://www.vpsw.com/blogbaby/PermaLink,guid,bb634e82-a78f-4fca-9d5d-a63616d70f99.aspx"&gt;interesting
results&lt;/a&gt;) ...&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.tangiblesoftwaresolutions.com/"&gt;Tanglible Software&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx"&gt;Developer
Fusion&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.google.com/search?q=c%23+vb+converter&amp;amp;sourceid=navclient-ff&amp;amp;ie=UTF-8&amp;amp;rlz=1B3GGGL_enUS176US213&amp;amp;aq=t"&gt;Or
Google For More&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
So learn 'em both -- double your code examples, double your employment opportunities
-- double your fun.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=c163aa6c-bbc2-4175-a653-00e46e2de3a1" /&gt;</description>
      <comments>http://www.vpsw.com/blogbaby/CommentView,guid,c163aa6c-bbc2-4175-a653-00e46e2de3a1.aspx</comments>
      <category>.NET</category>
      <category>2.0</category>
      <category>Annoyances</category>
    </item>
  </channel>
</rss>