相关疑难解决方法(0)

什么是System.Void?

我知道声明的方法void不会返回任何内容.

但似乎在C#void中只是一个关键字,而是一个真实的类型.
void是一个别名System.Void就像int那是System.Int32.

为什么我不允许使用那种类型? 它没有任何意义,但这只是对逻辑的一些想法.

也不

var nothing = new System.Void();
Run Code Online (Sandbox Code Playgroud)

(说我应该使用void(不是别名?))
也不是

var nothing = new void();
Run Code Online (Sandbox Code Playgroud)

编译.

也不可能使用这样的东西:

void GiveMeNothing() { }
void GiveMeNothingAgain()
{
    return GiveMeNothing();
}
Run Code Online (Sandbox Code Playgroud)

那么重点是什么System.Void

.net c# void

37
推荐指数
4
解决办法
7094
查看次数

int(Int32)是.NET中的对象还是原语(不是int?)?

int(aka Int32)是一个对象,还是.NET中的一个原语(我不是在询问int?)?

我在保存的单词上点击F12 int并获得:

public struct Int32 : IComparable, IFormattable, IConvertible, IComparable<int>, IEquatable<int>

{ ... }
Run Code Online (Sandbox Code Playgroud)

它不是从Object继承的,它是否意味着它int是一个原始的?

.net c# int primitive value-type

6
推荐指数
1
解决办法
5105
查看次数

标签 统计

.net ×2

c# ×2

int ×1

primitive ×1

value-type ×1

void ×1