Re: [Ikvm-developers] How to load Java Class in the .NET Application
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2007-09-14 06:22:38
|
Mark Walker wrote: > I am converting a series of objects in C# to Java equivalents. Along > the way I am finding that some types don't convert directly and so have > created a helper class to do the conversions. Am I reinventing the > wheel? Is there something like this already done? If not, can you look > (code below) at what I have done and let me know if there is a more > efficient method? [...] > public static java.lang.Integer Int(int value) The standard Java method java.lang.Integer.valueOf(int) will do the same. > public static int Int(java.lang.Integer value) Again, the standard Java method java.lang.Integer.intValue() will do. > public static bool Boolean(java.lang.Boolean value) Same here: java.lang.Boolean.booleanValue() > public static decimal Decimal(java.math.BigDecimal value) > public static java.math.BigDecimal Decimal(decimal value) Here there is no easy conversion, but these two types aren't really equival= ent. BigDecimal is arbitrary precision, while decimal is a 128 bit value ty= pe. Regards, Jeroen |