PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Convert Java to C#
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Convert Java to C#
![]() |
Convert Java to C# |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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" <jeff@discussions.microsoft.com> wrote in message news:B3977A91-2625-481B-87D4-C2EEF4214C4F@microsoft.com... > 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. > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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" <jeff@discussions.microsoft.com> wrote in message news:B3977A91-2625-481B-87D4-C2EEF4214C4F@microsoft.com... > 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. > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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" <jeff@discussions.microsoft.com> wrote in message news:B3977A91-2625-481B-87D4-C2EEF4214C4F@microsoft.com... > 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. > > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Thanks Guys,
I made it according you guys idea. "jeff" wrote: > 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. > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

