Convert the collection to an array list of doubles. - CSharp System

CSharp examples for System:Array Convert

Description

Convert the collection to an array list of doubles.

Demo Code

// Licensed under the Apache License, Version 2.0 (the "License");
using System.Collections.Generic;
using System;//  w  ww.j a  va2s  .  c  o  m

public class Main{
        /// <summary>
        /// Convert the collection to an array list of doubles.
        /// </summary>
        /// <param name="list">The list to convert.</param>
        /// <returns>The array of doubles.</returns>
        public static double[] ListToDouble(IList<double> list)
        {
            var result = new double[list.Count];
            int index = 0;
            foreach (double obj in list)
            {
                result[index++] = obj;
            }

            return result;
        }
}

Related Tutorials