Hi,
I'm trying to create a webservice that uses a dictionary class. The webservice is meant to take words from the dictionary and then give their meaning. When one word is input the meaning of that word is to be taken from the file. This is my current code but when I run it the meaning of the word chosen doesn't appear as the output. I get no output.
This is the code
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]publicclassService1:System.Web.Services.WebService{[WebMethod]publicclassTable{privateDictionary<string,string> _regionTimeValues =newDictionary<string,string>();privateString _words;publicTable(String words){
_words = words;}publicvoidAddValue(string key,string value){
_wordsTimeValues.Add(key, value);}}publicclassProgram{staticvoidMain(string[] args){Dictionary<string,Table> tables =newDictionary<string,Table>();
using (var reader =newStreamReader("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,newTable(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