当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - what is difference between void & other data type

问题描述:

This question already has an answer here:

  • What does void mean in C, C++, and C#?

    15 answers

网友答案:

void simply means nothing. See the MSDN:

When used as the return type for a method, void specifies that the method doesn't return a value. void isn't allowed in the parameter list of a method. A method that takes no parameters and returns no value is declared as follows:

public void SampleMethod()
{
    // Body of the method.
}

void is also used in an unsafe context to declare a pointer to an unknown type.

For more information, see Pointer types (C# Programming Guide).

void is an alias for the .NET Framework System.Void type.

分享给朋友:
您可能感兴趣的文章:
随机阅读: