"BGU" <pri@va.te> a écrit dans le message de news:
us7DLWvwFHA.1124@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view] > Hello, I've had numerous problems in past weeks calling ADO.NET
> from J#. The cause of these problems frequently stems from ADO.NET's
> inability to deal with J#'s native types. My code is full of casts to
> such types as
>
> System.Byte
> System.Int32
>
> because passing
>
> java.lang.Byte
> java.lang.Integer
>
> to ADO.NET creates exceptions. I might add that the messages from these
> exceptions are seldom helpful. A recent example was "Object must
> implement IConvertible."
>
> Are C# or VB programmers also having to deal with two type systems in
> their .NET Framework applications? I'd like to get input from others who
> have dealt with or thought about this limitation of J# (if it is a
> limitation).
It is not really a "limitation", rather a "design choice".
The problem is that J# tries to stick to the Java specs. And the Java specs
define java.lang.Byte/Integer/... classes that have a different API than
their .NET counterpart (System.SByte/Int32/...). So, the J# designers chose
to keep the two sets of classes separate.
Maybe they should have done things differently and "unified" the Java
classes with the .NET classes (like they did with java.lang.Object/String
and System.Object/String). This requires some tricks in the J# compiler
(like faking the Java API on these .NET APIs). IMO, this would have been
better, but everything is not obvious when we try to merge Java and .NET at
this level. For example, this would require that toString() and ToString()
behave differently on Double, because toString() formats in the invariant
culture in Java (the Java specs impose this) and ToString() formats in the
current culture in .NET (.NET specs impose this), and you have to deal with
these issues if you want to conform to the Java specs.
Bruno.
[quoted text, click to view] >
> Thanks,
> BGU
>