Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert Java to C#

2 views
Skip to first unread message

jeff

unread,
Mar 6, 2007, 12:29:28 PM3/6/07
to
Hi Guys,

I have a bunch of Java code, and want to convert them to C# code?

esp:

this code:

Java:
private const byte[] map2 = new byte[128];
static
{
for (int i=0; i<map2.length; i++) map2[i] = -1;
for (int i=0; i<64; i++) map2[map1[i]] = (byte)i;
}
To C#
???
???

how to convert it into initlize the const arry?
Sorry my first C# program?

Thanks.

Neil Cowburn

unread,
Mar 6, 2007, 12:49:45 PM3/6/07
to
private const byte[] map2 = new byte[128];

static void MyMethod() {
for (int i=0; i<map2.Length; i++) map2[i] = -1;


for (int i=0; i<64; i++) map2[map1[i]] = (byte)i;
}

That ought to do it.

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

Managed Code in the Embedded World

http://www.opennetcf.com/
http://www.smartdeviceframework.com/


"jeff" <je...@discussions.microsoft.com> wrote in message
news:B3977A91-2625-481B...@microsoft.com...

Nino Benvenuti

unread,
Mar 6, 2007, 1:32:36 PM3/6/07
to
You may find some success with the Java Language Conversion Assistant:
http://msdn2.microsoft.com/en-us/vstudio/aa718346.aspx

--
Nino Benvenuti
Device Application Development MVP
http://nino.net/blog


"jeff" <je...@discussions.microsoft.com> wrote in message
news:B3977A91-2625-481B...@microsoft.com...

<ctacke/>

unread,
Mar 6, 2007, 1:44:07 PM3/6/07
to
I think a static class ctor is where the init stuff should be.


--
Chris Tacke - Embedded MVP
OpenNETCF Consulting


Managed Code in the Embedded World

www.opennetcf.com
--

"jeff" <je...@discussions.microsoft.com> wrote in message
news:B3977A91-2625-481B...@microsoft.com...

jeff

unread,
Mar 6, 2007, 2:16:24 PM3/6/07
to
Thanks Guys,

I made it according you guys idea.

0 new messages