c# - 为什么 System.Decimal 继承层次

标签 c# resharper

我的印象是所有 值类型都继承自 System.ValueType ,因为我知道 Decimal是一个 struct,它也是一个值类型,它表示 Decimal 因此必须是一个值类型。那么为什么 resharper 会这样显示类型层次结构:

enter image description here

还是我误解了什么?

最佳答案

Decimal 不是从 IFormattable 派生,它只是实现 IFormattable 接口(interface)。

实现一个接口(interface)有时被称为“继承”,看起来几乎是一样的。

我更惊讶的是 resharper 没有显示其余的界面。
VS 中的转到定义 (F12) 显示:

 public struct Decimal : 
       IFormattable, IComparable, IConvertible, IDeserializationCallback, 
       IComparable<decimal>, IEquatable<decimal>

关于c# - 为什么 System.Decimal 继承层次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9393504/

相关文章:

regex - Resharper 9 中内联字符串的正则表达式语法突出显示信息存储在哪里?

c# - 我可以回到不使用 ReSharper 的状态吗?

visual-studio - 如何使用 ReSharper 重新格式化命名样式?

c# - 使用 HtmlElement(Collection) 和 webbrowser 在 html 中查找特定数据

c# - Azure定时器触发功能依赖注入(inject)问题

c# - 使用验证器确保用户填写了两个必填字段之一

c# - 有没有办法将设置从 Settings.StyleCop 同步到 ReSharper?

unit-testing - 使用 Resharper 7 测试运行程序进行 Jasmine 测试的堆栈跟踪

c# - 绑定(bind)到 DependencyProperty 仅适用于 "MyValue",不适用于 "{Binding PropertyHoldingMyValue}"

c# - 多行文本框中是否可以有不同颜色的线条?