Working with methods and tuples
Returning values from methods
- A method that performs some actions but does not return a value indicates this with the
voidtype before the name of the method.
- A method that performs some actions and returns a value indicates this with the type of the return value before the name of the method.
For example, in the next task, you will create two methods:
WriteToConsole: This will perform an action (writing some text to the console), but it will return nothing from the method, indicated by the
GetOrigin: This will return a text value, indicated by the
Let’s write the code:
Person.cs, add statements to define the two methods that I described earlier, as shown in the following code: