Search
ObservableCollection.insert Method
See Also
Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: None Language Filter: C# Language Filter: Visual Basic Language Filter: Java Language Filter: JavaScript Language Filter: C++ Language Filter: XAML
C#
Visual Basic
Java
JavaScript
C++
XAML
Introduction
General Information
What's New In This Release
Version History
Getting Started
Code Completion With VSDoc IntelliSense
Programming Interface Overview
Tutorials
Reference
MindFusion.Common
MindFusion.Common.Collections
IEnumerable Class
List Class
ObservableCollection Class
ObservableCollection Members
ObservableCollection Constructor
ObservableCollection Methods
add Method
clear Method
insert Method
remove Method
removeAt Method
removeRange Method
ObservableCollection Events
MindFusion.Controls
MindFusion.Scheduling
Licensing
Online Resources
Technical Support
MindFusion Products

Adds an item to the collection at the specified index.

Namespace: MindFusion.Common.Collections
Assembly: ObservableCollection.js

## Syntax

JavaScript Copy Code
function insert (index, item)

### Parameters

index

  Number. The index.

item

  Object. The object to add.

## Example

The following code creates a List with products. Then it adds several products to it and inserts one at the beginning of the List. List derives from ObservableCollection.

JavaScript Copy Code
var product1 = new Object(); product1.title = "Ford"; product1.price = 25345; var product2 = new Object(); product1.title = "BMW"; product1.price = 75300; ...... ..... List products = new List(); products.add(product1); products.add(product2); List products = new List([product1, product2, ...]); ..... ..... if(products.count() > 100) products.insert(0, newProduct);

## See Also

ObservableCollection Members
ObservableCollection Class
MindFusion.Common.Collections Namespace