K
Kenneth Baltrinic
I am trying to compare values coming out of a database record with known
default values. The defaults are in an array of type object (because they
can be of any basic data type, I am not working with weird stuff, just
strings, int, bools and DataTime values) My fields values for this record,
for convenience are also in an array of objects. Now I am trying to write
code like the following.
private void processData (object[] d, object[] a) // my Default values and
by Actual values
{
for(int i = 0; i < a.length; i++)
{
//problem, == is doing reference equality, I need value equality.
//For any give value i, it is safe to assume that d and a are
//of the same primitive data type, either int, long, single, double,
//bool, DateTime or string. Can I do this without having to do
//if else based on d.GetType()?
if( d == a )
{
...
}
}
}
default values. The defaults are in an array of type object (because they
can be of any basic data type, I am not working with weird stuff, just
strings, int, bools and DataTime values) My fields values for this record,
for convenience are also in an array of objects. Now I am trying to write
code like the following.
private void processData (object[] d, object[] a) // my Default values and
by Actual values
{
for(int i = 0; i < a.length; i++)
{
//problem, == is doing reference equality, I need value equality.
//For any give value i, it is safe to assume that d and a are
//of the same primitive data type, either int, long, single, double,
//bool, DateTime or string. Can I do this without having to do
//if else based on d.GetType()?
if( d == a )
{
...
}
}
}