万本电子书0元读

万本电子书0元读

顶部广告

Beginning C# Hands-On - The Core Language电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Tom Owsiak

出  版  社:Packt Publishing

出版时间:2017-08-31

字       数:48.0万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A C# 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# 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# 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# 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# 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# beginners who need a practical reference to core C# language features. You'll also gain a view of C# 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# 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.
目录展开

Title Page

Copyright

Beginning C# Hands-On – The Core Language

Credits

About the Author

www.PacktPub.com

Why subscribe?

Customer Feedback

Preface

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

Why C# and How to Download and Install the Visual Studio Community Edition

Locating and downloading the Visual Studio Community edition

Summary

Customizing Visual Studio to Make it Feel More Personal

Customizing Visual Studio

Selecting the text editor font and size

Selecting the Statement Completion font and size

Selecting the Environment font and size

Positioning Visual Studio panels

Summary

Creating and Running Your First Page

Starting a new project in Visual C#

Working with Solutions Explorer

Adding a document to your browser

Working with HTML code in Visual Studio

Launching the HTML code

Summary

Creating and Running a Page That Incorporates C#

Improving your first program

Working in the Design view

Working in the Source view

Adding comments

Adding attribute properties

Viewing the code in your browser

Summary

Creating and Using a Single Variable

Setting up Visual C# to deal with a variable

Variables represent change

Declaring a variable

Matching variable types

Running the code

Appending new text

Running the code with the appended text

Embedding a line break

Summary

String Interpolation and Updating Visual Studio

Selecting a NuGet package

Installing a NuGet package

Printing a variable

Summary

Formatting Output Strings for More Professional Results

Setting a value and formatting it as currency

Rounding the output

Formatting a value as a percent

Formatting a value as a date

Summary

Using Variables and Data Types

Setting a page title automatically

Setting a page title so that it can be controlled dynamically

Working with a Boolean data type

Using the decimal data type to set monetary values

Summary

Computed Variables and Basic Math

Declaring and setting two variables to signify two different salaries

Adding the two salaries

Averaging the two salaries

Summary

Interacting with Users Through the Web Page

Using Toolbox to search for a command

Adding an Event Handler

Working with string input

Converting string input to a numerical value

Working with methods

Working with the converted numerical value

Summary

Using Method Chaining to Write More Compact Code

Inserting a text box into the markup

Entering your C# code

Introducing method chaining

Testing your code

Summary

Reacting to a Single Condition with If/Else Blocks

Adding checkbox to your code

Adding a panel statement

Testing the checkbox

Working with the AutoPostBack property

Constructing an if statement

Constructing an else statement

Testing your code

Summary

Making a Variable Grow by Adding 1

Growing a variable by one

Another way to grow a variable

Summary

Repeating Blocks of Code with While Loops

Inserting a button

Modifying the button

Creating a while loop

Working with the Math class

Running the code

Experimenting with the code

Summary

Repeating Blocks of Code with For Loops

Inserting a button

Inserting ListBox

Binding in the code

Starting a for loop

Filling ListBox using the for loop

Summary

Iterating Over Collections with foreach Loops

Inserting TextBox

Inserting a label

Relating TextBox with Label

Generating a vertical output

Removing parts of the code to determine their impact

Summary

Examining Multiple Variable Values with Switch Blocks

Inserting DropBox and Label

Populating the drop-down list

Adding information to display about each drop-down item

Replicating cases

Running your program

Summary

Improving Input Processing with TryParse

Inserting a button and a textbox

Inserting the label

Introducing the TryParse method

Using TryParse to convert input into a numerical value

Running your program

Summary

Replacing If/Else Blocks with the Ternary Operator

Inserting two text boxes and a button

Creating the interface

Combining the ternary operator with TryParse

The Boolean power of TryParse

Running your program

Summary

Operators That Evaluate and Assign in Place

Inserting Button and Label

Introducing operators

Incrementing the value of a variable by 1 with ++

Incrementing the value of a variable by 2 with +=

Working with the -- operator

Working with the == operator

Summary

Checking Two Conditions with the Logical AND Operator

Setting up the project

Building your simulation

Determining if there is something in the text boxes

Displaying the results

Summary

Checking Two Conditions with the Logical OR Operator

Working with check boxes

Introducing the logical || (OR) operator

Experimenting with the logical || (OR) operator

Summary

Declaring, Setting, and Reading Arrays

Setting up the basic interface

Creating the array

Setting up an index

Using arrays to do addition

Using arrays to display an average

Viewing the page source

Summary

Iterating Over Arrays with foreach and for Loops

Setting up the beginning interface

Creating an array of strings

Introducing the foreach loop

Displaying the results

Running the program

Summary

Creating and Using a Simple Method

Setting up the user interface

Creating a method

Defining the body of the method

Working with the Convert class

Increasing the value of a variable with the GetIncreasedValue method

Outputting the results

Running your program

Summary

Passing Arrays into Methods

Setting up the user interface

Creating the method to find the total of values inside an array

Summing up the values

Using a foreach loop to grab entries inside the array

Adding up the values as the loop operates

Returning the value

Filling the array

Outputting the results

Running your program

Summary

Reference Type and Value Type Variables

Setting up the user interface

Reference type versus value type variables

Reference type variables

Value type variables

Summary

Creating More Flexible Methods with the params Keyword

Designing the starting markup

Creating the product method

Using the product method to multiply variables

Summary

Creating More Flexible Functions with the out Keyword

Setting up the beginning interface

Introducing language-integrated queries

Using the out parameter

Working with the average extension method

Working with the var keyword

Outputting the results of the Summarize method

Running and modifying your program

Summary

Combining the ref and out Keywords to Write Flexible Functions

Setting up the starting interface

Creating the GetValueAndInterest method

The ref and out keywords

Calculating principle and interest

Outputting the results

Running your program

Summary

The out keyword in C# 7

Creating the program template

Writing the Summarize function

Implementing the function

Running the program

Multidimensional Arrays

Understanding two-dimensional arrays

Setting up the initial interface

Coding a two-dimensional array

Printing out your results

Running the program

What else can you do?

Summary

Writing Easier Code with the Var and Dynamic Keywords

Setting up the project

Working with the dynamic keyword

Working with the var keyword

Running the program

Summary

Creating a Class with a Constructor and a Function

Our initial markup

Creating a class

Creating the class structure

Working with an instance

Setting the account balance

Displaying the balance using a method

Making a bank account object

Crunching the numbers

Running the program

Private versus public

Summary

Creating a Class with a Static Method

Setting up a simple initial interface

Introducing static classes

Creating the Reverse method

Coding the Reverse method

Reversing the array

Undoing the reversed string

Running the program

Summary

Creating a Class with an Object Property

Setting up a simple markup page

Creating a class

Introducing properties

Using the Circle class

Making a Circle object

Summary

Creating a Class with Static Fields, Functions, and Properties

Setting up the interface for this project

Creating the Truck class

Counting trucks

Closing IS Express (Windows users)

Documenting your program

Lesson review

Summary

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

Centralizing Default Code with Virtual Functions

Setting up a basic HTML for this project

Creating the Vehicle function

Writing a virtual function

Using the Virtual function

Overriding a method

Exploring the Vehicle class diagram and the base class object

Building the user interface

Making the Vehicles

Displaying the output

Running the program

Lesson review

Summary

Model Concepts with Abstract Classes

Introducing the basic HTML for this lesson's project

Adding the ThreeDShapes class

Introducing abstract classes

Determining volumes

Calculating the volume of a sphere

Taking advantage of the radius using the static System.Math

Calculating the volume of a cube

Entering data

Making a new sphere

Making a new cube

Displaying the results

Running the program

Lesson review

Summary

Using Custom Types as Return Types

Setting up the project

Creating the SongLibrary class

Sorting SongLibrary

Check it yourself

Displaying the song library

Running the program

Lesson review

Summary

Using Lists to Operate on Data Efficiently

Summarizing the values in a list

Introducing a generic namespace

Starting a list of doubles

Filling the list

Displaying the max, min, average, and sum

Squaring the results

Nesting lists

Summary

Writing Less Code with Polymorphism

Setting up the markup for this project

Creating the product class

Making a book class

Making a Shoe class

Capturing product information

Making a list of products

Displaying the results

Running the program

Chapter review

Summary

Using Interfaces to Express Common Behaviors

Building a hierarchy

Implementing the interface

Check yourself

Setting up the HTML

Check yourself

Building the interface

Running the program

Lesson review

Summary

Iterating over Instances with Indexers

Setting up a records project

Making the indexer

Reading the values back to the user

Making a new Records object

Running the program

Chapter review

Summary

Building Stabler Apps with Exception Handling

Setting up the HTML for this chapter

Using a try block

Throwing an exception

Using a catch block

Using a finally block

Running the program

Working with the StackTrace property

Investigating exceptions to determine their inheritance

Chapter review

Summary

Using Named and Optional Parameters

Setting up the Book class

Making the constructor

Building the search code

Our program interface

Working with lists

Searching a list

Displaying the results

Lesson review

Summary

Using the Null Coalescing Operator to Write Stabler Applications

Setting up the basic HTML for this project

Creating the Car class

Searching a database

Making a list of cars

The null coalescing operation

Displaying the search results

Debugging your program

Running the debugged program

One more fix

Lesson review

Summary

Overloading Operators to Perform Custom Operations

Creating a Vector class

Overloading a mathematical operator

Determining the sum of the vectors

Adding vectors

Making vectors

Displaying the results

Running the program

Lesson review

Summary

Using Enumerations to Represent Named Constants

Setting up a drop-down list

Creating the enumeration for this project

Running the program

Lesson review

Summary

Creating and Using Namespaces

Creating a new project with a new namespace

Making new public classes

Calculating interest

Working with dynamic link libraries

Creating a new website from a template

Determining the amount of interest

Making a library accessible

Summing the values

Running the program

Lesson review

Summary

Structs, Random Points, and Sleeping Threads

Adding a SimpleStruct class file

Coding the struct

Modifying the HTML to make use of the struct

Making an array of points

Displaying the results

Running the program

Debugging the program

Lesson review

Summary

Declaring, Creating, and Using Delegates

Setting up the HTML for this project

Checking out the interface

Making a delegate

Running the program

Summary

Switch Blocks with when

Creating the classes

Writing the Main function code

Running the program

Switch Blocks with Objects in C# 7.0

Creating the interface

Implementing the interface

Creating the Main() program

Running the program

Tuples

Creating the tuple function

Writing the Main() code

Running the program

Local functions in C# 7.0

Creating the application and core functions

Creating the local function

Running the code

Throwing Exceptions

Creating the main code

Throwing an exception

Catching an exception

Running the program

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部