Generic之前的C#默认值

时间:2014-08-08 09:53:26

标签: c#

我有一个旧项目,我无法将其重写为Generic类。

internal class MyOldClass
{
    public object Value { get; private set; }

    public bool IsDefaultValue { get; private set; }

    public MyOldClass(object value)
    {
        this.Value = value;
    }
}

我需要确定该值是否为默认值,但我不能使用

IsDefaultValue = value == null

因为数据类型,但我不知道如何使用默认运算符

IsDefaultValue = value == default(Value.GetType()) //This is syntax error

0 个答案:

没有答案
相关问题