[Mono-devel-list] Re: Can you help me in this conversion from VB to C# ?

Michael J. Ryan tracker1_lists at theroughnecks.com
Wed Sep 22 01:28:44 EDT 2004


Alessandro Torrisi wrote:
> public static string LockToKey(string Lock) {
>   string LockToKey;
>   --snip--
>   return LockToKey;
>  }

not going through the whole thing, but your private variable is named the
same as the function it belongs to, not sure if this is allowed, but just
seems like bad karma programming wise.  best bet is to use a variable that
is at least something else.. I tend to use "ret" as a variable name to
hold the return value... ymmv, and may not be the best either, but is at
least safer...  Lock, although not "lock" (iirc, a keyword)..

   while (h>255) {
    h = h - 256;
   }

umn, I think this would be better to use a modulus...
h = (h > 255)?(h%255):h;

if h is greater than 255, it assigns the modulus operator, otherwise
it re-assigns h, although...

if (h > 255) h = h%255;

may be better still... but the compiler should handle this in either case.

if you could send me the original functions, could probably do the rewrite
for you in a couple hours tomorrow night, if that long.. :)  providing the
original code actually works as needed...  I've spent plenty of time
converting code between .net and even classic asp languages (vbs/js) in the
past year.

-- 
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386  -  AIM/AOL: azTracker1  -  Y!: azTracker1  -  MSN/Win: (email)

Rules of Acquisition #095:
Expand or die.



More information about the Mono-devel-list mailing list