I've been doing some C# programming lately. I came across some difference from VB.net
Random Values:
ushort x1 = 0;
Random r = new Random();
x1=(ushort)r.Next(0,5);
will give a number between 0 and 5 in x1.
Typecasting:
In the example above r will return a int, to convert it to ushort add (ushort) before.
Passing Optional variables:
C# doesn't support Optional variables.
VB code:
Sub MySub(x as integer, Optional n as integer=33)
' n will be 33 if not set when sub is called.
End Sub
In C# this isn't supported, you will have to Overload the sub instead( = more code).
To get help convtering VB -> C# or C# -> VB there is a good site www.developerfusion.com/tools/convert/vb-to-csharp/
Or you can write you code using SharpDevelopment to convert between VB, C# and Boo.
Thursday, August 27, 2009
Subscribe to:
Posts (Atom)
MySQL to MariaDB
Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...
-
When converting an VB2008 application to VB2010 I run into trouble regarding COM objects while compiling. you get errors like: Error 1...
-
In a module you have declared a Structure or Enum that you will use through out a project. Module Module1 Public Structure dummy ...
-
Apache2 crashes on Ubuntu Linux 22.04.5 after Zabbix was updated to 7.0.26 During a upgrade of my Ubuntu server there was a new package for ...