Chart for .NET / User's Guide / Data Manipulation / Importing / Importing from Enumerable

In This Topic
    Importing from Enumerable
    In This Topic

    The data contained in the data series can be imported from any object which implements the IEnumerable interface. The type of the objects, which are contained in the enumerable class must be compatible with the data series type (for more information regarding the data series compatibility see the General Concepts topic).

    The import from an enumerable data source is implemented by the FillFromEnumerable method of the NDataSeries class. The method receives as a parameter a reference to an object that implements the IEnumerable interface.

    The following example imports a double array into the Values data series of a bar series.

    C#
    Copy Code
    // Create an array of doubles
    double [] arrValues = { 2, 14, 5, 9, 12, 7, 45, 13 };
    
    // import into the Values data series
    bar.Values.FillFromEnumerable(arrValues);
    
    Visual Basic
    Copy Code
    ' Create an array of doubles
    Dim arrValues() As Double = {2, 14, 5, 9, 12, 7, 45, 13}
    
    ' import into the Values data series
    bar.Values.FillFromEnumerable(arrValues)
    
    See Also