Free mag vol1 | Page 197

CHAPTER 4  CORE C# PROGRAMMING CONSTRUCTS, PART II static void Main(string[] args) { Console.WriteLine("***** Fun with Method Overloading *****\n"); // Calls int version of Add() Console.WriteLine(Add(10, 10)); // Calls long version of Add() Console.WriteLine(Add(900000000000, 900000000000)); // Calls double version of Add() Console.WriteLine(Add(4.3, 4.4)); } Console.ReadLine(); The Visual Studio IDE provides assistance when calling overloaded methods to boot. When you type in the name of an overloaded method (such as our good friend Console.WriteLine()), IntelliSense will list each version of the method in question. Note that you are able to cycle through each version of an overloaded method using the up and down arrow keys shown in Figure 4-1. Figure 4-1. Visual Studio IntelliSense for overloaded methods  Source Code The MethodOverloading application is located under the Chapter 4 subdirectory. That wraps up our initial examination of building methods using the syntax of C#. Next, let’s check out how to build and manipulate arrays, enumerations, and structures. 132