Preparation

Preparation

Up to this point, we have used pre-built tools like .Split(), .ToLower(), and .Add() to help us in our programming. These tools are called methods - they are sets of instructions that can be reused as needed. We are going to learn more about methods in the next lesson, but to get you thinking about this topic, you could imagine that methods are like tools in a tool-box.

Let’s say you are building a piece of furniture that requires you to fasten pieces together with nails. The hammer in your tool box is like a method - when you need to fasten a nail, you use the hammer. You can reuse the hammer whenever you want, without having to build or buy a new hammer for each nail.

There are many pre-built methods that we can use in c# (or in any other language); but, the real power of programming is in building our own methods. We can build specialized tools that can be reused in our programs to accomplish specific, repeated tasks. These methods might be simple, like adding two numbers; or, complex, like building a user profile. Simple or complex, the goal of creating methods is to reduce any repeated instructions in our code. where we see the same set of instructions being used over and over, we can clean up our code by organizing those instructions into methods.

In your notebook, create a list of the built-in methods you have used recently. What is the name of the method, what does it do, and what does it’s syntax look like?

Lesson Search Results

Showing top 10 results