Search results
30 mar 2024 · You use void as the return type of a method (or a local function) to specify that the method doesn't return a value. 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.
- Methods - C# | Microsoft Learn
An async method typically has a return type of...
- Methods - C# | Microsoft Learn
9 lis 2015 · The void keyword in the C# language indicates that a method returns nothing. You should use the return keyword which means that a method returns only one value. What type of return value of the method you should specify at signature of the method. For example: public string MethodA(bool isItReally) In the above code return value is type of string.
2 kwi 2024 · W tym artykule. Jako typ zwracany metody (lub funkcji lokalnej) można void określić, że metoda nie zwraca wartości. Można również użyć void jako typu odwołania, aby zadeklarować wskaźnik do nieznanego typu.
C# provides some pre-defined methods, which you already are familiar with, such as Main(), but you can also create your own methods to perform certain actions: Example Get your own C# Server. Create a method inside the Program class: class Program { static void MyMethod() { // code to be executed } } Example Explained.
20 cze 2023 · An async method typically has a return type of Task<TResult>, Task, IAsyncEnumerable<T>or void. The void return type is used primarily to define event handlers, where a void return type is required. An async method that returns void can't be awaited
2 paź 2024 · In C# void means that a method returns no value. Void is useful in many programs. But there are some compile-time errors that may be involved. Action. Method notes. Void methods receive parameters like all methods. They use a simple "return" statement that is followed by a semicolon. return. First example. The void keyword is common and useful.
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. [!code-csharp void method] You can also use void as a referent type to declare a pointer to an unknown type. For more information, see Pointer types.