1.词汇
- unknown 未知的
- reference type 引用类型
- value type 值类型
2.例句
-
I’m sure it’ll be a familiar problem to you, especially if you’ve done a lot of work with databases.
我相信对你来说这是一个非常熟悉的问题, 特别是如果你操作过数据库。
-
In some cases, you may not know the price.
在一些场合,你可能不知道价格。
-
If decimal were a reference type, you could just use null to represent the unknown price, but since it’s a value type.
如果decimal是一个引用类型,我们就可以使用null去代表未知的价格,但是它是一个值类型,我们不能那样做。
-
There are three common alternatives:
这里有三种通用替代方案:
-
a.Create a reference type wrapper around decimal.
a.创建一个引用类型,把值类型decimal包裹起来。
-
b.Maintain a separate Boolean flag indicating whether the price is known.
b.维护一个单独的标志布尔变量以判断价格是否有值。
-
c.Use a “magic value” (decimal.MinValue, for example) to represent the unknown price.
c.使用魔术值(比如decimal.MinValue)去代表未知的价格。