研究了switch documentation发现它只能打开整数类型 我开始寻找定义。我到处都找不到。我只能find a list of integral types .
我可以猜测整数类型是集成到语言中的类型,但是我更希望有一个正确的定义。有人有吗?
最佳答案
“整数”指的是整数类型(即整数)。在 C# 中,这意味着 int
、long
、short
等类型。
请参阅Integral Types Table (C# Reference) :
The following table shows the sizes and ranges of the integral types, which constitute a subset of simple types.
编辑:请记住,switch
语句也支持文字字符串。
关于c# - 什么是整体类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5154104/