【问题标题】:Base type of ValueTuple<T1, T2>ValueTuple<T1, T2> 的基本类型
【发布时间】:2019-12-07 11:01:04
【问题描述】:

下一个比较想不通:

var type = typeof(ValueTuple<int, string>);
if (type.BaseType == typeof(ValueTuple)) 
// returns 'false', however, 'type.BaseType' is 'System.ValueTuple' at runtime   

谁能解释一下?

【问题讨论】:

    标签: c#-7.0 valuetuple


    【解决方案1】:

    与任何struct 一样,基本类型是System.ValueType

    与人眼的相似性让我困惑了一两分钟。

    【讨论】:

    • 由于错字,我想删除我的问题,但如果这里有任何答案,我不能
    • 不要为此感到尴尬。我之所以这么做,是因为我知道除了 ValueType 之外别无他法。
    猜你喜欢
    • 2018-02-12
    • 1970-01-01
    • 2011-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多