Import Arrays Example (C#)
[C#]
/* COPYRIGHT(C), SIMPLEXAR SOFTWARE LIMITED, 2006-2008.
* All rights reserved.
*
* Use of this copyright notice is precautionary only, and does not imply
* publication or disclosure. The content of this work contains confidential
* and proprietary information of Simplexar Software Limited. Any duplication,
* modification, distribution, or disclosure in any form, in whole, or in part,
* is strictly prohibited without express prior written permission.
*/
// Get namespaces.
using System;
using Simplexar.Statsar;
// Start namespace.
namespace Simplexar.Examples.Statsar
{
/// <summary>
/// This example shows how to import data from different types of arrays
/// including one-dimensional arrays, multidimensional arrays and jagged
/// arrays.
/// </summary>
public static class Example
{
/// <summary>
/// The application entry point.
/// </summary>
public static void Main()
{
try
{
RunExample();
}
catch(Exception exception)
{
Console.WriteLine(exception);
}
Console.WriteLine("Press ENTER to terminate.");
Console.ReadLine();
}
private static void RunExample()
{
// Create a calculator.
StatsCalculator calculator = new StatsCalculator();
// Load a one-dimensional array.
DataSheet sheet1 = calculator.Load(
new double[]{ 44.5, -23.3, 15.67 });
Console.WriteLine(sheet1);
// Load a multidimensional array.
double[,] multiArray
= {{ -1, 3.4 }, { 7.8, 1.2 }, { 2.6, 9.4 }};
DataSheet sheet2 = calculator.Load(multiArray);
Console.WriteLine(sheet2);
// Load a jagged array.
double[][] jaggedArray = {
new double[]{ 2.1, 6.4 }, new double[]{ 8.8, 1.9 },
new double[]{ 3.7, 5.2 } };
DataSheet sheet3 = calculator.Load(jaggedArray);
Console.WriteLine(sheet3);
}
}
}