using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace MyWebService { /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod] public class Table { private Dictionary<string, string> _regionTimeValues = new Dictionary<string, string>(); private String _words; public Table(String words) { _words = words; } public void AddValue(string key, string value) { _wordsTimeValues.Add(key, value); } } public class Program { static void Main(string[] args) { Dictionary<string, Table> tables = new Dictionary<string, Table>(); using (var reader = new StreamReader("Data.csv")) { // First line contains column names. var columnNames = reader.ReadLine().Split(','); for (int i = 1; i < columnNames.Length; ++i) { var columnName = columnNames[i]; tables.Add(columnName, new Table(columnName)); } var line = reader.ReadLine(); while (line != null) { var columns = line.Split(','); for (int i = 1; i < columns.Length; ++i) { var table = tables[columnNames[i]]; table.AddValue(columns[0], double.Parse(columns[i])); } line = reader.ReadLine(); } } } } } }
If anyone can tell me where I'm going wrong that would be great. Thank you.
Milly