In this chapter, you will learn about creating and running your own methods.
Beginning C# 7 Hands-On - The Core Language
By :
Beginning C# 7 Hands-On - The Core Language
By:
Overview of this book
Beginning C# 7 Hands-On - The Core Language teaches you core C# language and syntax in a working Visual Studio environment. This book covers everything from core language through to more advanced features such as object-oriented programming techniques. This book is for C# 7 beginners who need a practical reference to core C# language features.
You'll also gain a view of C# 7 through web programming with web forms, so you'll learn HTML, basic CSS, and how to use a variety of controls, such as buttons and drop-down lists. You'll start with the fundamentals of C# and Visual Studio, including defining variables, interacting with users, and understanding data types, data conversions, and constants.
You'll move on to checking conditions using if/else blocks, and see how to use loops to do things such as repeat blocks of code. After covering various operators to evaluate and assign control structures, you'll see how to use arrays to store collections of data. By the time you’ve finished the book, you’ll know how to program the vital elements of the core C# language. These are the building blocks that you can then combine to build complex C# programs.
Table of Contents (60 chapters)
Preface
Free Chapter
Why C# and How to Download and Install the Visual Studio Community Edition
Customizing Visual Studio to Make it Feel More Personal
Creating and Running Your First Page
Creating and Running a Page That Incorporates C#
Creating and Using a Single Variable
String Interpolation and Updating Visual Studio
Formatting Output Strings for More Professional Results
Using Variables and Data Types
Computed Variables and Basic Math
Interacting with Users Through the Web Page
Using Method Chaining to Write More Compact Code
Reacting to a Single Condition with If/Else Blocks
Making a Variable Grow by Adding 1
Repeating Blocks of Code with While Loops
Repeating Blocks of Code with For Loops
Iterating Over Collections with foreach Loops
Examining Multiple Variable Values with Switch Blocks
Improving Input Processing with TryParse
Replacing If/Else Blocks with the Ternary Operator
Operators That Evaluate and Assign in Place
Checking Two Conditions with the Logical AND Operator
Checking Two Conditions with the Logical OR Operator
Declaring, Setting, and Reading Arrays
Iterating Over Arrays with foreach Loops
Creating and Using a Simple Method
Passing Arrays into Methods
Reference Type and Value Type Variables
Creating More Flexible Methods with the params Keyword
Creating More Flexible Functions with the out Keyword
Combining the ref and out Keywords to Write Flexible Functions
The out Keyword in C# 7
Multidimensional Arrays
Writing Easier Code with the Var and Dynamic Keywords
Creating a Class with a Constructor and a Function
Creating a Class with a Static Method
Creating a Class with an Object Property
Creating a Class with Static Fields, and Properties
Centralizing Common Code with Inheritance
Centralizing Default Code with Virtual Functions
Model Concepts with Abstract Classes
Using Custom Types as Return Types
Using Lists to Operate on Data Efficiently
Writing Less Code with Polymorphism
Using Interfaces to Express Common Behaviors
Iterating over Instances with Indexers
Building Stabler Apps with Exception Handling
Using Named and Optional Parameters
Using the Null Coalescing Operator to Write Stabler Applications
Overloading Operators to Perform Custom Operations
Using Enumerations to Represent Named Constants
Creating and Using Namespaces
Structs, Random Points, and Sleeping Threads
Declaring, Creating, and Using Delegates
Switch Blocks with when in C# 7.0
Switch Blocks with Objects in C# 7.0
Tuples in C# 7.0
Local functions in C# 7.0
Throwing Exceptions in C# 7.0
Tuples in C# 7.0, Part 2
Customer Reviews