PC Review


Reply
Thread Tools Rate Thread

Convert Java to C#

 
 
=?Utf-8?B?amVmZg==?=
Guest
Posts: n/a
 
      6th Mar 2007
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.



 
Reply With Quote
 
 
 
 
Neil Cowburn
Guest
Posts: n/a
 
      6th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:B3977A91-2625-481B-87D4-(E-Mail Removed)...
> 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.
>
>
>


 
Reply With Quote
 
Nino Benvenuti
Guest
Posts: n/a
 
      6th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:B3977A91-2625-481B-87D4-(E-Mail Removed)...
> 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.
>
>
>


 
Reply With Quote
 
Guest
Posts: n/a
 
      6th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:B3977A91-2625-481B-87D4-(E-Mail Removed)...
> 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.
>
>
>



 
Reply With Quote
 
=?Utf-8?B?amVmZg==?=
Guest
Posts: n/a
 
      6th Mar 2007
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.
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help convert the following Java to C# Charles Microsoft C# .NET 4 24th Aug 2008 04:55 AM
convert java web app 2 .NET web app =?Utf-8?B?bml6YW0=?= Microsoft ASP .NET 0 28th Feb 2006 05:45 AM
convert java to C# =?Utf-8?B?QmFybmV5?= Microsoft C# .NET 2 28th Jan 2005 04:22 AM
Convert java to C# BuddyWork Microsoft C# .NET 2 22nd Sep 2004 08:27 PM
Convert between C# and Java =?Utf-8?B?anE=?= Microsoft Dot NET 1 7th Aug 2004 01:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:34 AM.