V
Vik
I need to make some calculations, e.g. addition, on the objects x and y
which are numbers (of the same or different types) and may be DBNulls.
In VB, the following code is correct:
Public Shared Function XYZ(ByVal x, ByVal y)
XYZ = x + y
End Function
In C#, the identical code is wrong:
public static object XYZ(object x, object y) {
object z = x + y; //cannot add objects
return z;
}
Should I write the different procedures in C# for the different data types
or is there a better way?
Thanks.
which are numbers (of the same or different types) and may be DBNulls.
In VB, the following code is correct:
Public Shared Function XYZ(ByVal x, ByVal y)
XYZ = x + y
End Function
In C#, the identical code is wrong:
public static object XYZ(object x, object y) {
object z = x + y; //cannot add objects
return z;
}
Should I write the different procedures in C# for the different data types
or is there a better way?
Thanks.