阅读背景:

我应该使我的对象属性可以为空还是为每种类型使用CLR默认值?

来源:互联网 

I have been trying to figure out the best way to handle default values. Setting a ID value to 0 makes sense, but if it is a money value or other that is not initially set, when you encounter it later in your code, it is impossible to tell if it has been set or was set to 0. If a money value is set to null, then you know it has not been set. Additionally, when dealing with the database, it is simple to know if you need to write a null value to a field vs trying to figure out if it is supposed to be null or not. I have been trying to figure out the best way t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: