
C# 7 and .NET Core: Modern Cross-Platform Development

Methods are type members that execute a block of statements.
A method that performs some actions but does not return a value shows this by showing that it returns the void
type before the name of the method. A method that performs some actions and returns a value shows this by showing that it returns the type of that value before the name of the method.
For example, you will create two methods:
WriteToConsole
: This will perform an action (writing a line), but it will return nothing from the method, indicated by the void
keyword
GetOrigin
: This will return a string value, indicated by the string
keyword
Inside the Person
class, statically import System.Console
, and then add the following code:
// methods public void WriteToConsole() { WriteLine($"{Name} was born on {DateOfBirth:dddd, d MMMM yyyy}"); } public string GetOrigin() { return $"{Name} was born on {HomePlanet}"...
Change the font size
Change margin width
Change background colour