Illustrated C# 7, Fifth Edition

所需积分/C币:30 2018-02-21 21:35:16 34.96MB PDF
32
收藏 收藏
举报

Illustrated C# 7 The C# Language Presented Clearly, Concisely, and Visually, Fifth Edition
Illustrated c#7 Daniel solis Cal schrotenboer SAN JOSE, California, USA Kissimmee, Florida, USA ISBN-13(pbk):978-1-4842-3287-3 ISBN-13( electronic:978-1-4842-3288-0 htps://doi.org/10.1007/978-1-4842-3288-0 Library of Congress Control Number: 20189342 13 Copyright o 2018 by Daniel Solis and Cal Schrotenboer This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark The use in this publication of trade names, trademarks service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights While the advice and information in this book are believed to be true and accurate at the date of publication neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made The publisher makes no warranty express or implied with respect to the material contained herein Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Gwenan Spearing Development Editor: Laura Berendson Coordinating Editor: Nancy Chen Cover designed by e StudioCalamar CoverimagedesignedbyFreepik(www.freepik.com Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505, e-mail orders-nyaspringer-sbm.comorvisitwww.springeronline.comApressmediaLlcisaCaliforniaLlc,and the sole member (owner)is Springer Science+ Business Media Finance Inc(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation Forinformationontranslationspleasee-mailrights@apress.com,orvisitwww.apress.com/ rights-permissions Apress titles may be purchased in bulk for academic, corporate, or promotional use e Book versions and licenses are also available for most titles. For more information reference our Print and ebook bulk sales web page at www.apress.com/bulk-sales Any source code or other supplementary material referenced by the author in this book is available to readers on Githubviathebooksproductpagelocatedatwww.apress.com/9781484232873.Formoredetailedinformation pleasevisitwww.apress.com/source-code Printed on acid-free paper This book is dedicated to sian and galen dan This book is dedicated to paul, Kristin and alison Cal Contents About the authors About the technical reviewers Acknowledgments mmaaaaamaaamaamamaamaammammmmmmmmmmmammaammmaanamtanaasaantanaanaanaaaaaaaataaIaaIIaIIIIII XXXi Introduction… XXXIII Chapter 1: C# and the Net Framework aa ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■口■■■■ Before net 2 Windows Programming in the late 1990s....e.. 2 Goals for the next-Generation platform services Enter microsoft net Components of the. NET Framework An Improved Programming Environment Compiling to the common Intermediate Language Compiling to Native code and execution 334789 Overview of compilation and Execution The common language runtime 10 The common Language Infrastructure Important Parts of the cLI... 12 Review of the Acronyms 13 The evolution of ctt …14 Ct and the evolution of windows 15 CONTENTS Chapter 2: C# and. NET Core 17 The NET Framework Background 18 Why NET Core(and Amarin)? 18 Goals of. NET Core 19 Multiplatform Support 20 Rapid Development and Upgrades. Smaller Application Footprints, Simpler Deployment, and reduced versioning problems 20 Open Source Community Support 21 Improved Application Performance 21 Fresh start.… 21 The Development of. NET Core Where does this leave the NeT Framework? Where does amarin Fit In? 222 DBBBDBDBBDBDBBBDBDBBBDBDBBBDBDBBDBDBBBDBDBBBDBDBBDBDBBBBDBDBBBDBDBBBDBDBBDBDBBB Chapter 3: Overview of c# Programming . mmamammanmanmammman 23 A Simple C# Program .24 More about simple program……,,,,, identifiers 56 Keywords 27 Main: The Starting Point of a Program 28 Whitespace..ereerraereeeneenneanan. 28 Statements 29 Blocks 29 Text Output from a Program 30 Write 30 Writeline…… The Format String…,……,31 Multiple Markers and values... 33 Formatting Numeric Strings.…… 34 CONTENT Comments: Annotating the Code 40 More about comments 量日目日量目日量目面日量日1日日日日日目日目日目日量目面日量目面日日目目目目日目日目日量目日自量目日日日日 Documentation comments mm 41 Summary of Comment Types Chapter 4: Types, Storage, and Variables mmaaaanaaa. 43 A C# Program Is a Set of Type Declarations A Type Is a Template Instantiating a Type. Data members and function members ,46 Types of Members…… 46 Predefined Types 47 More about the predefined Types User-Defined Types 49 The stack and the Heap …50 The stack …50 The Heap value Types and Reference Types 52 Storing Members of a Reference type object 152 Categorizing the c# Types….........,…153 Variables …54 Var riab|eDec| arations…………….54 Multiple-Variable Declarations. Using the value of a variable Static Typing and the dynamic Keyword 57 Nullable Types……,, …157 Chapter 5: Classes: The Basics. mnmmmmmmmmmmmnam 59 Overview of classes 60 A Class Is an Active Data structure 日1日日日日面日1a日日日面日日日日日自a日面日日自日日日日面日1a日日自日日日面日日日自a日面日日日a Programs and Classes: A Quick Example 61 Declaring a class 162 CONTENTS Class members ,63 Fields 63 Methods Creating Variables and Instances of a class..mmmonmanann..anonmnnon 66 Allocating Memory for the data. mmmmmmm.mmmmmmnmmmnnmmn 67 Combining the steps… nstance Members 69 Access Modifiers 70 Private and public access 70 Accessing Members from Inside the class 73 Accessing Members from Outside the class 74 Putting It All Together 75 Chapter 6: Methods ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■a The structure of a method Code Execution in the Method body . .........79 ocal variables 80 Type Inference and the var Keyword 81 Local variables inside nested blocks 82 Local constants 83 F0 w of contro…………84 Method invocations DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDm 85 Return values…86 The return statement and void methods 88 ocal functions 000000000000000000D000DDDD0DDDDDDD 90 Parameters 91 Formal parameters… Actual Parameters Value Parameters ,94 Reference parameters 97 CONTENT Reference Types As value and reference Parameters 100 Output Parameters 104 Parameter Arrays 108 Method Invocation 109 Arrays As actual Parameters 112 Summary of Parameter Types .mmammmmm Ref local and ref return ,113 Method Overloading…,,…,………117 Named parameters 118 Optional Parameters........................................120 Stack Frames 124 Recursion 126 Chapter 7: More About Classes mmm aaa 129 Class Members 130 Order of member modifiers ,130 Instance Class Members …132 Static Fields 133 Accessing Static Members from Outside the class. Example of a static Field ,135 Lifetimes of static Members .m.m.m.m..m.m.m.. 136 Static Function members 137 Other Static Class Member Types 138 Member constants……139 Constants are like statics, mm 140 Properties… 14 Property Declarations and Accessors................,………,142 A Property Example…. 日面a Using a Property.....………………144 Properties and Associated Fields 145 CONTENTS Performing Other Calculations..........147 Read-Only and Write-Only Properties................................. 148 Properties VS. Public Fields 148 An Example of a Computed, Read-Only 149 Automatically Implemented Properties一Auto- properties…...,..,.,… ……150 Static Properties 151 Instance Constructors 152 Constructors with Parameters, m.m.m. 153 Default Constructors, m.m.m.m.m.m.. 154 Static Constructors 155 EXample of a Static Constructor…..............……156 object Initializers..........................157 Destructors …158 The readonly Modifier. The this Keyword. ……160 Indexers…1162 What is an Indexer? 163 Indexers and Properties Declaring an Indexer 164 The indexer set accessor ……165 The Indexer get Accessor...............................................166 More about Declaring the Indexer for the Employee Example ,167 Another Indexer Example …168 Indexer Overloading 169 Access Modifiers on accessors 170 Partial Classes and Partial Types 171 Partial methods…173

...展开详情
试读 127P Illustrated C# 7, Fifth Edition
立即下载 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
关注 私信
上传资源赚钱or赚积分
最新推荐
Illustrated C# 7, Fifth Edition 30积分/C币 立即下载
1/127
Illustrated C# 7, Fifth Edition第1页
Illustrated C# 7, Fifth Edition第2页
Illustrated C# 7, Fifth Edition第3页
Illustrated C# 7, Fifth Edition第4页
Illustrated C# 7, Fifth Edition第5页
Illustrated C# 7, Fifth Edition第6页
Illustrated C# 7, Fifth Edition第7页
Illustrated C# 7, Fifth Edition第8页
Illustrated C# 7, Fifth Edition第9页
Illustrated C# 7, Fifth Edition第10页
Illustrated C# 7, Fifth Edition第11页
Illustrated C# 7, Fifth Edition第12页
Illustrated C# 7, Fifth Edition第13页
Illustrated C# 7, Fifth Edition第14页
Illustrated C# 7, Fifth Edition第15页
Illustrated C# 7, Fifth Edition第16页
Illustrated C# 7, Fifth Edition第17页
Illustrated C# 7, Fifth Edition第18页
Illustrated C# 7, Fifth Edition第19页
Illustrated C# 7, Fifth Edition第20页

试读结束, 可继续阅读

30积分/C币 立即下载