public static void NonReactiveDictionarySuggestSevice() { var svc = new DictServiceSoapClient("DictServiceSoap"); //Starts a webservice call svc.BeginMatchInDict("wn", "react", "prefix", //AsyncCallback delegate iar => { DictionaryWord[] words = svc.EndMatchInDict(iar); foreach (DictionaryWord word in words) { Console.WriteLine(word.Word); } }, null ); //The above operation is quite "clumsy", //composition with our other Async data sources (TextBox) becomes difficult. //It is also not clear how one can cancel existing requests, //such that the Callback procedure is guaranteed not to be called anymore. //The data aspect of the Async call not being immediately apparent. Console.ReadLine(); //Wait to allow user to see output. }
private void Callback(IAsyncResult iar) { var words = _svc.EndMatchInDict(iar); foreach (var word in words) { Console.WriteLine(word.Word); } }
static void Main() { var svc = new DictServiceSoapClient("DictServiceSoap"); svc.BeginMatchInDict("wn", "react", "prefix", iar => { var words = svc.EndMatchInDict(iar); foreach (var word in words) Console.WriteLine(word.Word); }, null ); Console.ReadLine(); }
void old() { var svc = new DictServiceSoapClient("DictServiceSoap"); svc.BeginMatchInDict("wn", "react", "prefix", iar => { var words = svc.EndMatchInDict(iar); foreach (var w in words) { Console.WriteLine(w.Word); } }, null); Console.ReadLine(); }
static DictionaryWord[] EndMatch(IAsyncResult result) { return(service.EndMatchInDict(result)); }