Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CSharp 4 Language Specification.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
2.51 Mб
Скачать

11. Structs 376

11.1 Struct declarations 376

11.1.1 Struct modifiers 376

11.1.2 Partial modifier 377

11.1.3 Struct interfaces 377

11.1.4 Struct body 377

11.2 Struct members 377

11.3 Class and struct differences 377

11.3.1 Value semantics 378

11.3.2 Inheritance 379

11.3.3 Assignment 379

11.3.4 Default values 379

11.3.5 Boxing and unboxing 380

11.3.6 Meaning of this 382

11.3.7 Field initializers 382

11.3.8 Constructors 382

11.3.9 Destructors 383

11.3.10 Static constructors 383

11.4 Struct examples 383

11.4.1 Database integer type 383

11.4.2 Database boolean type 385

12. Arrays 389

12.1 Array types 389

12.1.1 The System.Array type 390

12.1.2 Arrays and the generic IList interface 390

12.2 Array creation 390

12.3 Array element access 391

12.4 Array members 391

12.5 Array covariance 391

12.6 Array initializers 391

13. Interfaces 395

13.1 Interface declarations 395

13.1.1 Interface modifiers 395

13.1.2 Partial modifier 395

13.1.3 Variant type parameter lists 396

13.1.3.1 Variance safety 396

13.1.3.2 Variance conversion 397

13.1.4 Base interfaces 397

13.1.5 Interface body 398

13.2 Interface members 398

13.2.1 Interface methods 399

13.2.2 Interface properties 399

13.2.3 Interface events 400

13.2.4 Interface indexers 400

13.2.5 Interface member access 400

13.3 Fully qualified interface member names 402

13.4 Interface implementations 403

13.4.1 Explicit interface member implementations 404

13.4.2 Uniqueness of implemented interfaces 406

13.4.3 Implementation of generic methods 407

13.4.4 Interface mapping 408

13.4.5 Interface implementation inheritance 411

13.4.6 Interface re-implementation 412

13.4.7 Abstract classes and interfaces 414

14. Enums 415

14.1 Enum declarations 415

14.2 Enum modifiers 415

14.3 Enum members 416

14.4 The System.Enum type 418

14.5 Enum values and operations 418

15. Delegates 419

15.1 Delegate declarations 419

15.2 Delegate compatibility 421

15.3 Delegate instantiation 422

15.4 Delegate invocation 422

16. Exceptions 425

16.1 Causes of exceptions 425

16.2 The System.Exception class 425

16.3 How exceptions are handled 425

16.4 Common Exception Classes 426

17. Attributes 427

17.1 Attribute classes 427

17.1.1 Attribute usage 427

17.1.2 Positional and named parameters 428

17.1.3 Attribute parameter types 429

17.2 Attribute specification 429

17.3 Attribute instances 435

17.3.1 Compilation of an attribute 435

17.3.2 Run-time retrieval of an attribute instance 435

17.4 Reserved attributes 435

17.4.1 The AttributeUsage attribute 436

17.4.2 The Conditional attribute 436

17.4.2.1 Conditional methods 437

17.4.2.2 Conditional attribute classes 439

17.4.3 The Obsolete attribute 440

17.5 Attributes for Interoperation 441

17.5.1 Interoperation with COM and Win32 components 441

17.5.2 Interoperation with other .NET languages 441

17.5.2.1 The IndexerName attribute 441

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]