1、Copyright Microsoft Corporation 1999-2000. All Rights Reserved.C# Language ReferenceOwners: Anders Hejlsberg and Scott WiltamuthFile: C# Language Reference.docLast saved: 6/27/2000Last printed: 6/9/2000Version 0.17bCopyright Microsoft Corporation 1999-2000. All Rights Reserved.NoticeThis documentati
2、on is an early release of the final documentation, which may be changed substantially prior to final commercial release, and is information of Microsoft Corporation.This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this documen
3、t. Information in this document is subject to change without notice. The entire risk of the use or the results of the use of this document remains with the user. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of th
4、is document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.Microsoft may have patents,
5、patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyr
6、ights, or other intellectual property.Unpublished work. 1999-2000 Microsoft Corporation. All rights reserved.Microsoft, Windows, Visual Basic, and Visual C+ are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries.Other product and company names me
7、ntioned herein may be the trademarks of their respective owners.Table of ContentsCopyright Microsoft Corporation 1999-2000. All Rights Reserved. iiiTable of Contents1. Introduction .11.1 Hello, world .11.2 Automatic memory management.21.3 Types.41.4 Predefined types.51.5 Array types.71.6 Type system
8、 unification.91.7 Statements.101.7.1 Statement lists and blocks.101.7.2 Labeled statements and goto statements .101.7.3 Local declarations of constants and variables.111.7.4 Expression statements .111.7.5 The if statement.111.7.6 The switch statement.121.7.7 The while statement .121.7.8 The do state
9、ment .131.7.9 The for statement .131.7.10 The foreach statement.131.7.11 The break statement and the continue statement.141.7.12 The return statement.141.7.13 The throw statement .141.7.14 The try statement.141.7.15 The checked and unchecked statements.141.7.16 The lock statement .141.8 Classes .141
10、.9 Structs .151.10 Interfaces.151.11 Delegates.171.12 Enums .181.13 Namespaces .181.14 Properties .191.15 Indexers.201.16 Events.211.17 Versioning.221.18 Attributes .242. Lexical structure.272.1 Phases of translation .272.2 Grammar notation .272.3 Pre-processing.282.3.1 Pre-processing declarations.2
11、82.3.2 #if, #elif, #else, #endif .292.3.3 Pre-processing control lines .302.3.4 #line.312.3.5 Pre-processing identifiers.312.3.6 Pre-processing expressions .312.3.7 Interaction with white space .322.4 Lexical analysis.332.4.1 Input .33C# LANGUAGE REFERENCEiv Copyright Microsoft Corporation 1999-2000
12、. All Rights Reserved.2.4.2 Input characters .332.4.3 Line terminators .332.4.4 Comments .332.4.5 White space .332.4.6 Tokens.332.5 Processing of Unicode character escape sequences.342.5.1 Identifiers .342.5.2 Keywords .362.5.3 Literals .362.5.3.1 Boolean literals.362.5.3.2 Integer literals.362.5.3.
13、3 Real literals.372.5.3.4 Character literals.382.5.3.5 String literals .392.5.3.6 The null literal .402.5.4 Operators and punctuators .403. Basic concepts .413.1 Declarations .413.2 Members .433.2.1 Namespace members.433.2.2 Struct members .433.2.3 Enumeration members .443.2.4 Class members .443.2.5 Interface members.443.2.6 Array members.443.2.7 Delegate members.443.3 Member access.443.3.1 Declared accessibility .443.3.2 Accessibility domains .453.3.3 Protected access .473.3.4 Accessibility constraints .483.4 Signatures and overloading.493.5 Scopes .503.5.1 Name hiding.523.5.1.1