Book description
A C# 7 beginners guide to the core parts of the C# language!
About This Book
- Learn C#, Visual Studio, and Object Oriented Programming,
- See practical examples of all the core C# language features so that you can easily master them yourself
- Use the C# 7 programming language to work with code and data, which can be applied to other programming languages as well,
- Complete a variety of programming assignments for hands-on practice, as you move through the course.
Who This Book Is For
This book will appeal to anyone who is interested in learning how to program in C#. Previous programming experience will help you get through the initial sections with ease, although, it's not mandatory to possess any experience at all.
What You Will Learn
- Learn C#, Visual Studio, and object-oriented programming
- Learn all the core C# 7 language syntax with hands-on working examples
- Learn everything from basic variable assignments to complex multidimensional arrays
- Go through practical examples of all the core C# 7 language features so that you can easily master them yourself
- Use the C# programming language to work with code and data, which can be applied to other programming languages as well
In Detail
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.
Style and approach
A comprehensive book that blends theory with just the right amount of practical code implementations, to help you get up and running with the C# programming language. You'll also get to work with other tools and technologies that complement C# programming. Each core part of the C# 7 language is coded as you learn, and code output is tested every time to verify the syntax is working as expected, so it's easy for you to learn directly from the working code examples.
Table of contents
- Preface
- 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
-
Setting up the interface for this lesson
- Creating the Vehicles class file
- Introducing instance variables
- Writing a function to get the make of a vehicle
- Creating the Truck class file
- Creating the sedan class file
- The structure of our program
- Designing the interface for user input
- Creating an array of strings
- Displaying the results
- Running the program
- Lesson review
- Summary
-
Setting up the interface for this lesson
- Centralizing Default Code with Virtual Functions
-
Model Concepts with Abstract Classes
- Introducing the basic HTML for this lesson's project
- Summary
- 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
Product information
- Title: Beginning C# 7 Hands-On – The Core Language
- Author(s):
- Release date: August 2017
- Publisher(s): Packt Publishing
- ISBN: 9781788296540
You might also like
book
Beginning C# 7 Programming with Visual Studio 2017
Easily get started programming using the ultra-versatile C# 7 and Visual Studio 2017 Beginning C# 7 …
article
Run Llama-2 Models Locally with llama.cpp
Llama is Meta’s answer to the growing demand for LLMs. Unlike its well-known technological relative, ChatGPT, …
article
Use GitHub Copilot: Additional Tips
Using GitHub Copilot can feel like magic. The tool automatically fills out entire blocks of code--but …
video
GenAI Essentials for Everyone - Overview
Our team of experts has hand-selected and organized the most crucial concepts and practical applications of …