Chapter 3: We Have Our Methods
In This Chapter
Defining a method
Passing arguments to a method
Getting results back
Programmers need to be able to break large programs into smaller chunks that are easy to handle. For example, the programs contained in previous chapters of this minibook reach the limit of the amount of programming information a person can digest at one time.
C# lets you divide your class code into chunks known as methods. Properly designed and implemented methods can greatly simplify the job of writing complex programs.
Defining and Using a Method
Consider the following example:
public int anInt; // Nonstatic
static int staticInt // Static
public void InstanceMethod() // Nonstatic
Console.WriteLine(“this is an instance method”); ...