void (C# reference)
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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
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:Submit and view feedback for