[Mono-devel-list] DataSetHelper Class and Mono problems?
Jon at destra.com
Thu Oct 14 23:09:00 EDT 2004
My first time on the list so I should say I'm VERY new to Mono having
recently compiled the RPMS for RedHat Enterprise Linux and I'm now
trying to get some code ported from Windows and the MS framework.
I've tried to take some code I have running on Windows using the
DataSetHelper class by Microsoft which is available here:
However I run in to a problem with one of the functions throwing an
exception under Mono. I've created a bit of test code to reproduce this
Unhandled Exception: System.InvalidCastException: Cannot cast from
source type to destination type.
in <0x00085> Test.TestClass:Add (object,object)
in <0x0004e> Test.TestClass:Main (string)
I'm no expert at C# and only a beginner when it comes to Mono. Can
anyone offer me some advice here?
Can I even achieve what I'm trying to do here under Mono?
Sample code to reproduce the exception:
static void Main(string args)
int i1 = 34; int i2 = 8;
int i3 = (int)((decimal)i1 + (decimal)i2);
i3 = (int)(TestClass.Add(i1, i2));
private static object Add(object a, object b)
//Adds two values - if one is DBNull, then returns the other
if (a is DBNull)
if (b is DBNull)
return ((decimal)a + (decimal)b);
More information about the Mono-devel-list