ObservableCollectionnames = new ObservableCollection (); names.Add("John"); names.Insert(1, "Jane");
ObservableCollectionnumbers = new ObservableCollection (); numbers.Insert(0, 1); numbers.Insert(1, 2); numbers.Insert(2, 3);
ObservableCollectionIn this example, the InsertRange method is used to add a range of double values at index 1 in the Observable Collection "decimalNumbers". The range is defined as a separate list and then added using a foreach loop.decimalNumbers = new ObservableCollection (); List range = new List { 1.1, 2.2, 3.3, 4.4 }; foreach (double num in range) { decimalNumbers.Add(num); } decimalNumbers.InsertRange(1, range);