Name: Anonymous 2009-02-22 2:52
I am looking for an elegant way to know whether a bunch of fields with property methods have values set to them, where the default "default-values" could be a valid value, or that I have another default value for them.
For example, with a lot of int variables, their default are 0. But 0 could be meaningful. So things like -1 or -2,147,483,648..etc would be used, but to make things worse, for some fields, it would be -1, but for some other, it would be -2,147,483,648..etc
Instead of checking case by case for each variable with their respective custom-default-value, is there a some more elegant way to do that?
-nullable type with a "?? check" inside the get/set{..}?
-using a dictionary with variable name as key and my default value as value and chking it?
-accompany each variable with a bool called sth like xxx_Updated?
For example, with a lot of int variables, their default are 0. But 0 could be meaningful. So things like -1 or -2,147,483,648..etc would be used, but to make things worse, for some fields, it would be -1, but for some other, it would be -2,147,483,648..etc
Instead of checking case by case for each variable with their respective custom-default-value, is there a some more elegant way to do that?
-nullable type with a "?? check" inside the get/set{..}?
-using a dictionary with variable name as key and my default value as value and chking it?
-accompany each variable with a bool called sth like xxx_Updated?