Check out example codes for "array list dictionary c#". It will help you in understanding the concepts better.
Code Example 1
int[] myIntArray = new int[10];
myIntArray[0] = 0;
myIntArray[1] = 10;
myIntArray[2] = 20;
myIntArray[3] = 30;
// Assignment via loop
for (int i=0; i<myIntArray.Length; i++)
{
myIntArray[i] = i * 10;
}
// Foreach loop over array
foreach (int element in myIntArray)
{
Console.WriteLine("${element}");
}
Code Example 2
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
class Program
{
static void Main()
{
Dictionary<string, int> myDictionary = new Dictionary<string, int>();
myDictionary.Add("bob", 27);
myDictionary.Add("fred", 33);
int theAge = myDictionary["bob"];
}
}
Code Example 3
using System.Collections.Generic;
List<string> myList = new List<string>();
myList.Add("Hello");
myList.Add("World");
myList.Add(10); // Compiler Error
Learn ReactJs, React Native from akashmittal.com