VB.NET and C# are basically the same. There are the same structures in C#
as there are in VB.NET and, for the most part, the reverse.
Sequence (a series of operations performed serially):
-----------------------------------------------------
C# and VB.NET are identical in this. Both list operations from top to
bottom within a block, whether it's a function, a procedure, or whatever you
want to call it.
Repetition (a structure to perform one or more operations multiple times):
------------------------------------------------------------------------
C# has several forms of repetition. For loops look like this:
for ( start condition; repeat condition; increment condition )
do..while( continue condition )
while ( continue condition )
In each case, the continue condition defines some expression which can tell
the loop whether to continue or not. If the expression is true, the loop
continues; if not, the loop exits. The for loop is a special case which
allows for some initialization before the first loop (setting the loop
index, maybe, to 0), as well as a specific increment step (increment the
index before checking the repeat condition, maybe). So, a simple for loop
might be something of this nature:
for ( i = 0; i < 10; i++ )
{
// Stuff to be repeated.
}
do
{
} while ( expression );
while ( expression )
{
}
do..while and while loops differ only in when the expression is evaluated:
before the first loop or after.
Selection (a structure for executing certain code depending on an expression
value):
----------------------------------------------------------------------------
-------
select( expression )
{
case value:
// Stuff to do if expression evaluates to value.
break;
default:
// Stuff to do if none of the case values match the expression
value.
break;
}
The C# select..case structure is essentially identical to the VB.NET
Select...Case structure. Same idea, virtually same syntax.
if ( expression )
{
// Stuff to do if expression is true.
}
else
{
// Stuff to do if expression is false.
}
Again, basically identical to VB.NET.
Random syntactic bits
----------------------
Obviously, declarations of things are somewhat different in C# than in
VB.NET. Variable types are listed before the variable name, not after with
an "As" in the middle. There's really *nothing* to cause you not to be able
to read C# just as easily as VB.NET, though. Maybe your first couple of
attempts to *write* code in C# would generate a lot of errors, but reading
it should be very easy to pick up. I doubt that those of us who would
normally use C# first ever took a class or something in VB.NET. We just
knew enough about programming to know that VB.NET needed to have these
constructs and looked up the syntax in the help. You can do the same with
C#.
Paul T.