X hits on this document

968 views

0 shares

0 downloads

0 comments

34 / 396

Chapter ‎18   Unsafe code

public class List {

const int defaultCapacity = 4;

Constant

object[] items; int count;

Fields

public List(): List(defaultCapacity) {}

public List(int capacity) { items = new object[capacity]; }

Constructors

public int Count { get { return count; } }

public string Capacity { get { return items.Length; } set { if (value < count) value = count; if (value != items.Length) { object[] newItems = new object[value]; Array.Copy(items, 0, newItems, 0, count); items = newItems; } } }

Properties

public object this[int index] { get { return items[index]; } set { items[index] = value; OnListChange(); } }

Indexer

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.21

Document info
Document views968
Page views968
Page last viewedThu Dec 08 16:56:06 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments