Студопедия Главная Случайная страница Обратная связь

Разделы: Автомобили Астрономия Биология География Дом и сад Другие языки Другое Информатика История Культура Литература Логика Математика Медицина Металлургия Механика Образование Охрана труда Педагогика Политика Право Психология Религия Риторика Социология Спорт Строительство Технология Туризм Физика Философия Финансы Химия Черчение Экология Экономика Электроника

Table of Contents 3 страница





10.1.3 Type parameters...................................................................................................................... 271

10.1.4 Class base specification............................................................................................................ 272

10.1.4.1 Base classes...................................................................................................................... 272

10.1.4.2 Interface implementations................................................................................................... 274

10.1.5 Type parameter constraints...................................................................................................... 274

10.1.6 Class body............................................................................................................................... 278

10.2 Partial types................................................................................................................................... 278

10.2.1 Attributes................................................................................................................................ 278

10.2.2 Modifiers................................................................................................................................. 279

10.2.3 Type parameters and constraints............................................................................................... 279

10.2.4 Base class............................................................................................................................... 280

10.2.5 Base interfaces........................................................................................................................ 280

10.2.6 Members................................................................................................................................. 280

10.2.7 Partial methods........................................................................................................................ 281

10.2.8 Name binding.......................................................................................................................... 283

10.3 Class members.............................................................................................................................. 283

10.3.1 The instance type..................................................................................................................... 285

10.3.2 Members of constructed types.................................................................................................. 285

10.3.3 Inheritance.............................................................................................................................. 286

10.3.4 The new modifier..................................................................................................................... 287

10.3.5 Access modifiers..................................................................................................................... 287

10.3.6 Constituent types..................................................................................................................... 287

10.3.7 Static and instance members..................................................................................................... 287

10.3.8 Nested types........................................................................................................................... 288

10.3.8.1 Fully qualified name........................................................................................................... 289

10.3.8.2 Declared accessibility......................................................................................................... 289

10.3.8.3 Hiding............................................................................................................................... 289

10.3.8.4 this access......................................................................................................................... 290

10.3.8.5 Access to private and protected members of the containing type........................................... 290

10.3.8.6 Nested types in generic classes........................................................................................... 291

10.3.9 Reserved member names......................................................................................................... 292

10.3.9.1 Member names reserved for properties............................................................................... 292

10.3.9.2 Member names reserved for events.................................................................................... 293

10.3.9.3 Member names reserved for indexers................................................................................. 293

10.3.9.4 Member names reserved for destructors............................................................................. 293

10.4 Constants...................................................................................................................................... 293

10.5 Fields............................................................................................................................................ 295

10.5.1 Static and instance fields.......................................................................................................... 296

10.5.2 Readonly fields........................................................................................................................ 297

10.5.2.1 Using static readonly fields for constants............................................................................. 297

10.5.2.2 Versioning of constants and static readonly fields................................................................. 298

10.5.3 Volatile fields........................................................................................................................... 298

10.5.4 Field initialization...................................................................................................................... 299

10.5.5 Variable initializers................................................................................................................... 300

10.5.5.1 Static field initialization....................................................................................................... 301

10.5.5.2 Instance field initialization................................................................................................... 302

10.6 Methods........................................................................................................................................ 302

10.6.1 Method parameters.................................................................................................................. 304

10.6.1.1 Value parameters.............................................................................................................. 306

10.6.1.2 Reference parameters........................................................................................................ 306

10.6.1.3 Output parameters............................................................................................................. 307

10.6.1.4 Parameter arrays............................................................................................................... 308

10.6.2 Static and instance methods...................................................................................................... 310

10.6.3 Virtual methods....................................................................................................................... 310

10.6.4 Override methods.................................................................................................................... 312

10.6.5 Sealed methods........................................................................................................................ 314

10.6.6 Abstract methods..................................................................................................................... 315

10.6.7 External methods..................................................................................................................... 316

10.6.8 Partial methods........................................................................................................................ 317

10.6.9 Extension methods................................................................................................................... 317

10.6.10 Method body.......................................................................................................................... 318

10.6.11 Method overloading................................................................................................................ 318

10.7 Properties...................................................................................................................................... 318

10.7.1 Static and instance properties.................................................................................................... 320

10.7.2 Accessors............................................................................................................................... 320

10.7.3 Automatically implemented properties....................................................................................... 325

10.7.4 Accessibility............................................................................................................................ 325

10.7.5 Virtual, sealed, override, and abstract accessors......................................................................... 327

10.8 Events........................................................................................................................................... 328

10.8.1 Field-like events....................................................................................................................... 330

10.8.2 Event accessors....................................................................................................................... 332

10.8.3 Static and instance events......................................................................................................... 333

10.8.4 Virtual, sealed, override, and abstract accessors......................................................................... 333

10.9 Indexers........................................................................................................................................ 333

10.9.1 Indexer overloading.................................................................................................................. 337

10.10 Operators.................................................................................................................................... 337

10.10.1 Unary operators..................................................................................................................... 339

10.10.2 Binary operators.................................................................................................................... 339

10.10.3 Conversion operators.............................................................................................................. 340

10.11 Instance constructors.................................................................................................................... 342

10.11.1 Constructor initializers............................................................................................................ 343

10.11.2 Instance variable initializers..................................................................................................... 344

10.11.3 Constructor execution............................................................................................................. 344

10.11.4 Default constructors............................................................................................................... 346

10.11.5 Private constructors............................................................................................................... 346

10.11.6 Optional instance constructor parameters................................................................................. 347

10.12 Static constructors........................................................................................................................ 347

10.13 Destructors.................................................................................................................................. 349

10.14 Iterators....................................................................................................................................... 351

10.14.1 Enumerator interfaces............................................................................................................ 351

10.14.2 Enumerable interfaces............................................................................................................ 351

10.14.3 Yield type.............................................................................................................................. 351

10.14.4 Enumerator objects................................................................................................................ 351

10.14.4.1 The MoveNext method..................................................................................................... 352

10.14.4.2 The Current property........................................................................................................ 353

10.14.4.3 The Dispose method......................................................................................................... 353

10.14.5 Enumerable objects................................................................................................................ 353

10.14.5.1 The GetEnumerator method.............................................................................................. 354

10.14.6 Implementation example......................................................................................................... 354

11. Structs............................................................................................................................................. 361

11.1 Struct declarations.......................................................................................................................... 361

11.1.1 Struct modifiers....................................................................................................................... 361

11.1.2 Partial modifier........................................................................................................................ 362

11.1.3 Struct interfaces...................................................................................................................... 362

11.1.4 Struct body.............................................................................................................................. 362

11.2 Struct members.............................................................................................................................. 362

11.3 Class and struct differences............................................................................................................ 362

11.3.1 Value semantics...................................................................................................................... 363

11.3.2 Inheritance.............................................................................................................................. 364

11.3.3 Assignment............................................................................................................................. 364

11.3.4 Default values......................................................................................................................... 364

11.3.5 Boxing and unboxing................................................................................................................ 365

11.3.6 Meaning of this........................................................................................................................ 366

11.3.7 Field initializers........................................................................................................................ 366

11.3.8 Constructors............................................................................................................................ 367

11.3.9 Destructors............................................................................................................................. 368

11.3.10 Static constructors.................................................................................................................. 368

11.4 Struct examples............................................................................................................................. 368

11.4.1 Database integer type.............................................................................................................. 368

11.4.2 Database boolean type............................................................................................................. 370

12. Arrays.............................................................................................................................................. 373

12.1 Array types................................................................................................................................... 373

12.1.1 The System.Array type............................................................................................................ 374

12.1.2 Arrays and the generic IList interface....................................................................................... 374

12.2 Array creation............................................................................................................................... 374

12.3 Array element access..................................................................................................................... 375

12.4 Array members.............................................................................................................................. 375

12.5 Array covariance........................................................................................................................... 375

12.6 Array initializers............................................................................................................................. 375

13. Interfaces........................................................................................................................................ 379

13.1 Interface declarations..................................................................................................................... 379

13.1.1 Interface modifiers................................................................................................................... 379

13.1.2 Partial modifier........................................................................................................................ 379

13.1.3 Variant type parameter lists...................................................................................................... 380

13.1.3.1 Variance safety................................................................................................................. 380

13.1.3.2 Variance conversion.......................................................................................................... 381

13.1.4 Base interfaces........................................................................................................................ 381

13.1.5 Interface body......................................................................................................................... 382

13.2 Interface members......................................................................................................................... 382

13.2.1 Interface methods.................................................................................................................... 383

13.2.2 Interface properties.................................................................................................................. 383

13.2.3 Interface events....................................................................................................................... 384

13.2.4 Interface indexers.................................................................................................................... 384

13.2.5 Interface member access......................................................................................................... 384

13.3 Fully qualified interface member names........................................................................................... 386

13.4 Interface implementations............................................................................................................... 386

13.4.1 Explicit interface member implementations................................................................................ 387

13.4.2 Uniqueness of implemented interfaces....................................................................................... 389

13.4.3 Implementation of generic methods........................................................................................... 390

13.4.4 Interface mapping.................................................................................................................... 391

13.4.5 Interface implementation inheritance......................................................................................... 394

13.4.6 Interface re-implementation...................................................................................................... 395

13.4.7 Abstract classes and interfaces................................................................................................. 396

14. Enums............................................................................................................................................. 399

14.1 Enum declarations.......................................................................................................................... 399

14.2 Enum modifiers.............................................................................................................................. 399

14.3 Enum members.............................................................................................................................. 400

14.4 The System.Enum type................................................................................................................... 402

14.5 Enum values and operations............................................................................................................ 402

15. Delegates........................................................................................................................................ 403

15.1 Delegate declarations..................................................................................................................... 403

15.2 Delegate compatibility.................................................................................................................... 405

15.3 Delegate instantiation..................................................................................................................... 405

15.4 Delegate invocation........................................................................................................................ 406

16. Exceptions...................................................................................................................................... 409

16.1 Causes of exceptions...................................................................................................................... 409

16.2 The System.Exception class............................................................................................................ 409

16.3 How exceptions are handled........................................................................................................... 409

16.4 Common Exception Classes............................................................................................................ 410

17. Attributes........................................................................................................................................ 411

17.1 Attribute classes............................................................................................................................ 411

17.1.1 Attribute usage........................................................................................................................ 411

17.1.2 Positional and named parameters.............................................................................................. 412

17.1.3 Attribute parameter types......................................................................................................... 413

17.2 Attribute specification..................................................................................................................... 413

17.3 Attribute instances......................................................................................................................... 418

17.3.1 Compilation of an attribute........................................................................................................ 418

17.3.2 Run-time retrieval of an attribute instance.................................................................................. 419

17.4 Reserved attributes........................................................................................................................ 419

17.4.1 The AttributeUsage attribute.................................................................................................... 419

17.4.2 The Conditional attribute........................................................................................................... 420

17.4.2.1 Conditional methods........................................................................................................... 420

17.4.2.2 Conditional attribute classes................................................................................................ 422

17.4.3 The Obsolete attribute.............................................................................................................. 423

17.5 Attributes for Interoperation............................................................................................................ 424

17.5.1 Interoperation with COM and Win32 components...................................................................... 424

17.5.2 Interoperation with other.NET languages.................................................................................. 425

17.5.2.1 The IndexerName attribute................................................................................................. 425

18. Unsafe code..................................................................................................................................... 427

18.1 Unsafe contexts............................................................................................................................. 427

18.2 Pointer types.................................................................................................................................. 429

18.3 Fixed and moveable variables.......................................................................................................... 432

18.4 Pointer conversions........................................................................................................................ 432

18.4.1 Pointer arrays.......................................................................................................................... 433

18.5 Pointers in expressions................................................................................................................... 434

18.5.1 Pointer indirection.................................................................................................................... 435

18.5.2 Pointer member access............................................................................................................ 435







Дата добавления: 2015-09-07; просмотров: 419. Нарушение авторских прав; Мы поможем в написании вашей работы!




Практические расчеты на срез и смятие При изучении темы обратите внимание на основные расчетные предпосылки и условности расчета...


Функция спроса населения на данный товар Функция спроса населения на данный товар: Qd=7-Р. Функция предложения: Qs= -5+2Р,где...


Аальтернативная стоимость. Кривая производственных возможностей В экономике Буридании есть 100 ед. труда с производительностью 4 м ткани или 2 кг мяса...


Вычисление основной дактилоскопической формулы Вычислением основной дактоформулы обычно занимается следователь. Для этого все десять пальцев разбиваются на пять пар...

Методы анализа финансово-хозяйственной деятельности предприятия   Содержанием анализа финансово-хозяйственной деятельности предприятия является глубокое и всестороннее изучение экономической информации о функционировании анализируемого субъекта хозяйствования с целью принятия оптимальных управленческих...

Образование соседних чисел Фрагмент: Программная задача: показать образование числа 4 и числа 3 друг из друга...

Шрифт зодчего Шрифт зодчего состоит из прописных (заглавных), строчных букв и цифр...

Именные части речи, их общие и отличительные признаки Именные части речи в русском языке — это имя существительное, имя прилагательное, имя числительное, местоимение...

Интуитивное мышление Мышление — это пси­хический процесс, обеспечивающий познание сущности предме­тов и явлений и самого субъекта...

Объект, субъект, предмет, цели и задачи управления персоналом Социальная система организации делится на две основные подсистемы: управляющую и управляемую...

Studopedia.info - Студопедия - 2014-2024 год . (0.011 сек.) русская версия | украинская версия