- 博客(45)
- 收藏
- 关注
原创 8.10 Delegates
8.10 DelegatesDelegates enable scenarios that some other languages have addressed with function pointers. However,unlike function pointers, delegates are object-oriented and type-safe.A delegate decla
2005-11-30 19:16:00 815
原创 8.9 Interfaces
8.9 InterfacesAn interface defines a contract. A class or struct that implements an interface must adhere to its contract.Interfaces can contain methods, properties, events, and indexers as members.Th
2005-11-30 19:14:00 704
原创 8.7.11 Inheritance
Classes support single inheritance, and the type object is the ultimate base class for all classes.The classes shown in earlier examples all implicitly derive from object. The exampleusing System;clas
2005-11-30 19:13:00 735
原创 8.8 Structs
8.8 StructsThe list of similarities between classes and structs is long.structs can implement interfaces, and can havethe same kinds of members as classes. Structs differ from classes in several impor
2005-11-30 19:13:00 745
原创 8.7.8 Instance constructors
An instance constructor is a member that implements the actions required to initialize an instance of a class.The exampleusing System;class Point{public double x, y;public Point() {this.x = 0;this.y =
2005-11-30 19:12:00 767
原创 8.7.9 Destructors
A destructor is a member that implements the actions required to destruct an instance of a class. Destructorscannot have parameters, they cannot have accessibility modifiers, and they cannot be called
2005-11-30 19:12:00 663
原创 8.7.10 Static constructors
A static constructor is a member that implements the actions required to initialize a class. Static constructorscannot have parameters, they cannot have accessibility modifiers, and they cannot be cal
2005-11-30 19:12:00 680
原创 8.7.5 Events
8.7.5 EventsAn event is a member that enables an object or class to provide notifications. A class defines an event byproviding an event declaration (which resembles a field declaration, though with a
2005-11-30 19:11:00 874 1
原创 8.7.6 Operators
An operator is a member that defines the meaning of an expression operator that can be applied to instancesof the class. There are three kinds of operators that can be defined: unary operators, binary
2005-11-30 19:11:00 615
原创 8.7.7 Indexers
An indexer is a member that enables an object to be indexed in the same way as an array. Whereasproperties enable field-like access, indexers enable array-like access.As an example, consider the Stack
2005-11-30 19:11:00 648
原创 8.7.3 Methods
8.7.3 MethodsA method is a member that implements a computation or action that can be performed by an object or class.Methods have a (possibly empty) list of formal parameters, a return value (unless
2005-11-30 19:10:00 703
原创 8.7.4 Properties
8.7.4 PropertiesA property is a member that provides access to a characteristic of an object or a class. Examples ofproperties include the length of a string, the size of a font, the caption of a wind
2005-11-30 19:10:00 709
原创 8.7 Classes
8.7 ClassesClass declarations define new reference types. A class can inherit from another class, and can implementinterfaces.Class members can include constants, fields, methods, properties, events,
2005-11-30 19:09:00 718
原创 8.7.1 Constants & 8.7.2 Fields
8.7.1 ConstantsA constant is a class member that represents a constant value: a value that can be computed at compile-time.Constants are permitted to depend on other constants within the same program
2005-11-30 19:09:00 625
原创 8.6 Statements
8.6 StatementsC# borrows most of its statements directly from C and C++, though there are some noteworthy additions andmodifications. The table below lists the kinds of statements that can be used, an
2005-11-30 19:08:00 762
原创 8.6 Statements(cont')
do statements static void Main() {string s;do { s = Console.ReadLine(); }while (s != "Exit");}for statements static void Main(string[] args) {for (int i = 0; i Console.WriteLine(args[i]);}foreach stat
2005-11-30 19:08:00 591
原创 8.5 Expressions
8.5 ExpressionsC# includes unary operators, binary operators, and one ternary operator. The following table summarizes theoperators, listing them in order of precedence from highest to lowest:Section
2005-11-30 19:07:00 806
原创 8.4 Automatic memory management(cont')
public void Push(object o) {first = new Node(o, first);}class Node{public Node Next;public object Value;public Node(object value): this(value, null) {}public Node(object value, Node next) {Next = next
2005-11-28 22:16:00 804
原创 8.3 Variables and parameters(cont')
pre: x = 1, y = 2post: x = 2, y = 1The ref keyword must be used in both the declaration of the formal parameter and in uses of it. The use ofref at the call site calls special attention to the paramet
2005-11-28 22:15:00 702
原创 8.4 Automatic memory management
8.4 Automatic memory managementManual memory management requires developers to manage the allocation and de-allocation of blocks ofmemory. Manual memory management can be both time-consuming and diffi
2005-11-28 22:15:00 760
原创 8.3 Variables and parameters
8.3 Variables and parameters Variables represent storage locations. Every variable has a type that
2005-11-28 22:14:00 1053
原创 8.2.4 Type system unification
8.2.4 Type system unificationC# provides a .unified type system.. All types.including value types.derivefrom the type object. It ispossible to call object methods on any value, even values of .primiti
2005-11-27 21:12:00 660
原创 8.2.3 Array types
8.2.3 Array typesArrays may be single-dimensional or multi-dimensional. Both .rectangular. and .jagged. arrays aresupported.Single-dimensional arrays are the most common type. The exampleusing System;
2005-11-27 21:09:00 761
原创 8.2.3 Array types(cont')
In contrast, the variable j2 denotes a .jagged. array, or an .array of arrays.. Specifically, j2 denotes anarray of an array of int, or a single-dimensional array of type int[]. Each of these int[] va
2005-11-27 21:09:00 685
原创 8.2.1 Predefined types
8.2.1 Predefined typesC# provides a set of predefined types, most of which will be familiar to C and C++ developers.The predefined reference types are object and string. The type object is the ultimat
2005-11-27 21:08:00 808
原创 [c#]8.2.1 Predefined types(cont')
results in a compile-time error because the expression i = 0 is of type int, and if statements require anexpression of type bool.The char type is used to represent Unicode code units. A variable of ty
2005-11-27 21:08:00 738
原创 8.2.2 Conversions
8.2.2 ConversionsThe predefined types also have predefined conversions. For instance, conversions exist between thepredefined types int and long. C# differentiates between two kinds of conversions: im
2005-11-27 21:08:00 756
原创 8. Language Overview
This clause is informative.C# (pronounced .C Sharp.) is a simple, modern, object oriented, and type-safe programming language. Itwill immediately be familiar to C and C++ programmers. C# combines the
2005-11-27 21:07:00 711
原创 8.2 Types
8.2 TypesC# supports two kinds of types: value types and reference types. Value types include simple types (e.g.,char, int, and float), enum types, and struct types. Reference types include class type
2005-11-27 21:07:00 790
原创 6. Acronyms and abbreviations
This clause is informative.The following acronyms and abbreviations are used throughout this International Standard:BCL . Base Class Library, which provides types to represent the built-in data types
2005-11-27 21:06:00 725
原创 7. General description
This clause is informative.This International Standard is intended to be used by implementers, academics, and applicationprogrammers. As such, it contains a considerable amount of explanatory material
2005-11-27 21:06:00 906
原创 5. Notational conventions(cont')
for-statement:for ( ; ; ) embedded-statementfor ( for-initializer ; ; ) embedded-statementfor ( ; for-condition ; ) embedded-statementfor ( ; ; for-iterator ) embedded-statementfor ( for-initializer ;
2005-11-27 20:57:00 706
原创 4. Definitions
For the purposes of this International Standard, the following definitions apply. Other terms are definedwhere they appear in italic type or on the left side of a syntax rule. Terms explicitly defined
2005-11-27 20:56:00 802
原创 4. Definitions (cont')
Implementation . particular set of software (running in a particular translation environment underparticular control options) that performs translation of programs for, and supports execution of metho
2005-11-27 20:56:00 647
原创 5. Notational conventions
Lexical and syntactic grammars for C# are interspersed throughout this specification. The lexical grammardefines how characters can be combined to form tokens (§9.4), the minimal lexical elements of t
2005-11-27 20:56:00 935
原创 2. Conformance
Conformance is of interest to the following audiences:?Those designing, implementing, or maintaining C# implementations.?Governmental or commercial entities wishing to procure C# implementations.?Test
2005-11-27 20:55:00 649
原创 3. References
provisions of this International Standard. For dated references, subsequent amendments to, or revisions of,any of these publications do not apply. However, parties to agreements based on this Internat
2005-11-27 20:55:00 733
原创 1. Scope
This clause is informative.This International Standard specifies the form and establishes the interpretation of programs written in theC# programming language. It specifies?The representation of C# pr
2005-11-27 20:54:00 622
原创 C# Language Specification
Brief historyThis International Standard is based on a submission from Hewlett-Packard, Intel, and Microsoft, thatdescribes a language called C#, which was developed within Microsoft. The principal in
2005-11-27 20:53:00 1529
原创 Table of Contents
1. Scope.................................................................. 12. Conformance ........................................................ 33. References .....................................
2005-11-27 20:53:00 919
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人