int[] numbers = {1, 2, 3, 4, 5}; Array.Resize(ref numbers, numbers.Length + 1); numbers[numbers.Length-1] = 6;
Listfruits = new List {"apple", "orange", "banana"}; fruits.Add("pear");
DictionaryThis code adds three new entries to a dictionary of products and prices. The Add() method is used to add both the key string and the value integer for each entry. The C# Block AddEntry is part of the system.collections package in the .NET library.productPrices = new Dictionary (); productPrices.Add("apple", 1); productPrices.Add("orange", 2); productPrices.Add("banana", 3);