添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

In this article

You use void as the return type of a method (or a local function ) to specify that the method doesn't return a value.

public static void Display(IEnumerable<int> numbers)
    if (numbers is null)
        return;
    Console.WriteLine(string.Join(" ", numbers));

You can also use void as a referent type to declare a pointer to an unknown type. For more information, see Pointer types.

You cannot use void as the type of a variable.

See also

  • System.Void
  • Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.

    Submit and view feedback for

    This product