int32 的后继者

发布于 2024-09-02 06:00:17 字数 107 浏览 7 评论 0原文

C# 中 int32 的直接继承者是什么?是int还是int16?

通过继承,我的意思是给定class A : B {},那么A类是我的类,B类是我继承的类。

What is an immediate inheritor of int32 in C#? Is it int or int16?

By inheritance, I mean given class A : B {} then class A is my class, and class B is a class that I inherit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

旧城空念 2024-09-09 06:00:17

假设您正在谈论继承(不是很清楚)...

System.ValueType,有效 - 或什么都没有,取决于您的观点。

请注意,intSystem.Int32 是同一类型;第一个是另一个的别名。

值类型(例如 int)隐式继承自 System.ValueType(或 System.Enum),并且不能从其他任何类型继承。

Assuming you're talking about inheritance (it's not terribly clear)...

System.ValueType, effectively - or nothing, depending on your viewpoint.

Note that int and System.Int32 are the same type; the first is an alias for the other.

Value types (such as int) implicitly inherit from System.ValueType (or System.Enum) and can't inherit from anything else.

南…巷孤猫 2024-09-09 06:00:17

基本类型是 ValueType
此外,它还实现了接口 IComparableIComparableIConvertibleIEquatableIFormatable

The basetype is ValueType.
Additionally it implements the interfaces IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormatable.

-小熊_ 2024-09-09 06:00:17

不确定这个问题,但 C# 有以下数据类型:

System.Int16(可以使用关键字short),16位

System.Int32(可以使用关键字int),32位

它们是值类型,因此两者都不能继承除System.ValueType之外的任何类型,两者之间没有继承关系。

Not sure on the question, but C# has the following datatypes:

System.Int16 (keyword short can be used), 16bit

System.Int32 (keyword int can be used), 32bit

They are value types so neither can inherit from anything other than System.ValueType, there is no inheritance between the two.

累赘 2024-09-09 06:00:17

关键字intSystem.Int32 的别名。由于 System.Int32 是一个结构体,因此它没有子类型。与所有结构一样,它的直接超类型是 System.ValueType (它本身具有超类型 System.Object。)

Int16 (也称为关键字 < code>short) 也是一个结构体,因此没有子类型和超类型 System.ValueType。它与 intInt32 没有类型关系。

The keyword int is an alias for System.Int32. Since System.Int32 is a struct, it has no subtypes. Like all structs, its immediate supertype is System.ValueType (which itself has supertype System.Object.)

Int16 (also known by the keyword short) is also a struct, so has no subtypes, and supertype System.ValueType. It has no type relation to int and Int32.

风月客 2024-09-09 06:00:17

来自 MSDN

所有值类型隐式继承自
System.ValueType 类,其中
反过来,继承自类对象。

虽然我不确定我是否很好地理解了你的问题。如果您正在寻找 Int32 的子级,我认为没有 这里指出的

From MSDN:

All value types implicitly inherit from
the class System.ValueType, which, in
turn, inherits from class object.

Although I'm not exactly sure if I understood your question well. If you are looking for a child of Int32, I think there is none as indicated here.

爱*していゐ 2024-09-09 06:00:17

我不明白这个问题,但 int 只是 Int32 的别名,因此通过消除过程,您问题的答案可能是 int16

I don't understand the question but int is just an alias for Int32 so by the process of elimination the answer to your question is probably int16.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文