C# 7 Quick Syntax Reference 2nd Edition

所需积分/C币:3 2018-08-23 18:51:34 1.93MB PDF
5
收藏 收藏
举报

This quick C# 7 guide is a condensed code and syntax reference to the C# programming language, updated with the latest features of C# 7.3 for .NET and Windows 10. It presents the essential C# 7 syntax in a well-organized format that can be used as a handy reference. In the C# 7 Quick Syntax Refe
C# 7 Quick Syntax Reference: A Pocket Guide to the language, APIs, and library Mikael olsson Hammarland, Lansi-Suomi, finland ISBN13(pbk):978-1-48423816-5 ISBN-13( electronic):978-1-4842-3817-2 htps:// doi. org/10.1007/978-1-48423817-2 Library of Congress Control Number: 2018954673 Copyright o 2018 by Mikael Olsson 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: Steve Anglin Development Editor: Matthew Moodie Coordinating editor: Mark Powers Cover designed by eStudio calamar 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-mailorders-ny@springer-sbm.com,orvisitwww.springeronline.comApressMediaLlcisa California LLC and the sole member (owner) is Springer Science +Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation Forinformationontranslations,pleasee-maileditorial@apress.com;forreprint,paperback,or audiorightspleaseemailbookpermissions@springernature.com Apress titles may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles. For more information reference our print andebooKbuLkSaleswebpageathttp://www.apress.com/bulk-sales Any source code or other supplementary material referenced by the author in this book is available toreadersonGithubviathebooksproductpagelocatedatwww.apress.com/9781484238165 Formoredetailedinformationpleasevisithttp://www.apress.com/source-code Printed on acid-free paper Table of contents About the author ■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■ About the technical reviewer ntroduction Chapter 1: Hello World ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Choosing an|DE….…,… Creating a Project………… Hello world IntelliSense Chapter 2: Compile and run ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■a■■■■■■■■■■口■■ 5 Visual Studio Compilation Console compilation Language Version.… Comments Chapter 3: Variables mmmr 6699 Data Types 1■面面正面面面面面面日面面面面日面面面面,面面面面看正面面面面面面面音面面日面面面面日面面面面面面面面面面面面面国面面正面面面 Declaration…10 Assignment Integer Types.. Floating-Point Types ,12 TABLE OF CONTENTS Char Type 13 Bool Type ariable Scope 13 Chapter 4: Operators ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■ 15 Arithmetic operators.meaent 15 Assignment Operators 16 Combined assignment operators 16 Increment and Decrement operators .mmmmmmmmmmmm.16 Comparison Operators.mmen...semen. 17 Logical Operators… Bitwise Operators Operator Precedents Chapter 5: Strings.mmmammmmmmmmmmmaamamaamammm 21 String Concatenation…… 21 Escape characters 22 String Compare String Members…… String builder class 24 Chapter 6: Arrays. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■ 25 Array Declaration…… Array Allocation 25 Array assignment. Array Access…....,,…26 Rectangular Arrays 26 Jagged Arrays 27 TABLE OF CONTENTS Chapter 7: Conditionals g29 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■口■■■ If statement Switch statement…30 Goto statement 31 Ternary operator.emnmemmemnnnannnmnnnennmnnonn 31 Chapter 8: LOops.amaRar 33 Wh|eL00p,,,,, …33 D0- while Loop.… 33 For Loop 34 Foreach l00p…...............,.35 Break and continue. mmm 35 Chapter 9: Methods mmmmmmmmmmmmmmm.37 Defining Methods,… 37 Calling methods…38 Method parameters…38 Params Keyword 39 Method Overloading…, Optional Parameters Named Arguments…,,, Return statement 41 Value and Reference Types 42 Pass by value 43 Pass by Reference 43 Ref Keyword. Out Keyword ocal Methods TABLE OF CONTENTS Chapter 10: Class.BBRBBBRRRIERRRRRRRIRBRRRRRRIRRRRERERIIIBIRIIIIIIRIRIEaa 49 Object Creation 49 Accessing Object Members. Constructor…50 This Keyword 52 Constructor Overloading 52 Constructor Chaining . Initial Field values 53 Default constructor 54 Object Initializers… 54 Partial class 55 Garbage collector 56 Destructor 56 Null Keyword Nullable Types…,,,,,, 58 Nu| Coalescing Operator.......,……59 Null-Conditional operator Default values…60 Chapter 11: Inheritance ammmmmmmmammmmmmmmma61 Downcast and Upcast 62 The is and as Keywords 63 Pattern Matching ..................................................................63 Boxing 65 Unboxing .66 TABLE OF CONTENTS Chapter 12: Redefining Members ■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Hiding Members n67 Overriding Members .ammamamamaamaam.tnm. Hiding and0 overriding…, 69 Sealed Keyword 69 Base Keyword..a..... 69 Chapter 13: Access Levels.ant g73 Private Access,om. 73 Protected Access 74 Internal Access 75 Protected Internal Access mm,76 Private protected access Public Access 77 Top-Level Access Level!…..,.,……78 nner classes…78 Access Level Guideline mmm. 79 Chapter 14: Static ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■口■■■■■■■口aa 81 Accessing Static Members Static Methods 82 Static Fields…83 Static Classes 83 Static Constructor 84 Extension Methods 84 TABLE OF CONTENTS Chapter 15: Properties IRERRERERaImIIIIIRIRIE.87 Property Advantages .88 Read-Only and Write-Only Properties 90 Property Access Levels. Auto-Implemented Properties . Chapter 16: Indexers mmmaammmmammammmaammmmmmmmmaa 93 Indexer parameters 94 Indexer Overloading mmmmmm....m.mm.....m. 95 Chapter 17: Interfaces ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■ 97 Interface Signatures. Interface Example Functionality Interface 99 Class Interface mmm. 99 Chapter 18: Abstract.mmmmaammammmmammmmammmmmammmma101 Abstract Members Abstract Example Abstract Classes and interfaces m103 Chapter 19: Namespaces.aamn ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■I u105 Nested Namespaces.mmmmammmnmmmammmnmnmmmmmmmnmmnmmmnmmmnmmm. 105 Namespace Access 106 Using Directive.......................107 Chapter 20: Enumaaamaaaa mIEIREIIa 109 Enum Example . Enum constant values Enum Constant Type 110 TABLE OF CONTENTS Enum Access Levels and scope.mmmmamnanan Enum methods…111 Chapter 21: Exception Handling mmammmammmm 113 Try-Catch Statement Catch B|ock… 114 Exception Filters 15 Fina! Block.....,,,,,,……117 The using Statement Throwing Exceptions...ammann. 119 Chapter 22: Operator Overloading ammmmmmmmmmammmmmmaamm 121 Operator Overloading Example...memonmmmmammmmn 121 Binary Operator Overloading…………12 Unary Operator Overloading….,,,,…,……,…………122 Return Types and parameters ,123 Overloadable Operators 123 True and False Operator Overloading 124 Chapter 23: Custom Conversions ammamaammammmamam am 127 Implicit Conversion Methods. marianna. 127 Explicit Conversion Methods.nmnmnmnnamnmnoeanmonmnnanmmmamnnn 128 Chapter 24: Struct ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 129 Struct variable 129 Struct constructors 130 Struct field initializers………131 Struct Struct guideline

...展开详情
试读 127P C# 7 Quick Syntax Reference 2nd Edition
立即下载 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
  • 签到新秀

  • 分享王者

关注 私信
上传资源赚钱or赚积分
最新推荐
C# 7 Quick Syntax Reference 2nd Edition 3积分/C币 立即下载
1/127
C# 7 Quick Syntax Reference 2nd Edition第1页
C# 7 Quick Syntax Reference 2nd Edition第2页
C# 7 Quick Syntax Reference 2nd Edition第3页
C# 7 Quick Syntax Reference 2nd Edition第4页
C# 7 Quick Syntax Reference 2nd Edition第5页
C# 7 Quick Syntax Reference 2nd Edition第6页
C# 7 Quick Syntax Reference 2nd Edition第7页
C# 7 Quick Syntax Reference 2nd Edition第8页
C# 7 Quick Syntax Reference 2nd Edition第9页
C# 7 Quick Syntax Reference 2nd Edition第10页
C# 7 Quick Syntax Reference 2nd Edition第11页
C# 7 Quick Syntax Reference 2nd Edition第12页
C# 7 Quick Syntax Reference 2nd Edition第13页
C# 7 Quick Syntax Reference 2nd Edition第14页
C# 7 Quick Syntax Reference 2nd Edition第15页
C# 7 Quick Syntax Reference 2nd Edition第16页
C# 7 Quick Syntax Reference 2nd Edition第17页
C# 7 Quick Syntax Reference 2nd Edition第18页
C# 7 Quick Syntax Reference 2nd Edition第19页
C# 7 Quick Syntax Reference 2nd Edition第20页

试读结束, 可继续阅读

3积分/C币 立即下载