I have the problem, that comparing values after changing the type (in this case to int) does not work:
In my point of view (see the debugger), _pkValue and _defaultValue are both integers with the same value.
The problem is, that the if-statement should not be entered, because both values are 0.
I'm sure it is a very simple thing, but i can't figure it out.
EDIT: Code
object pkVal = pks.First().Value.GetValue(this, null);
if (pkVal != null)
{
var defaultValue = TypeHelper.GetDefaultValue(pkVal.GetType());
var _pkValue = Convert.ChangeType(pkVal, pkVal.GetType());
var _defaultValue = Convert.ChangeType(defaultValue, pkVal.GetType());
if (_pkValue != _defaultValue)
{
canset = false;
}
}
Thank you!
Aucun commentaire:
Enregistrer un commentaire