Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Methods


A block of statements that have the access modifier, name, return type, and parameters (which may or may not be there) are nothing but a method. A method is meant to perform some tasks.

Note

Methods are meant to call either by another method or by another program.

How to use a method?

As said earlier, methods are meant to perform some actions. So, any method or program that needs to utilize these actions could call/consume/use the defined method.

A method has various element discussed as follows:

  • Access modifier: A method should have an access modifier (refer to the previous section for more details on modifier). The modifier helps us define the scope of method or the availability of the method, for example. A method defined using the private modifier can only be visible to its own class.
  • Return type: After performing an action, a method may or may not return something. Method return type is based on the data types (refer to day two for information on datatypes). For example, if method...