private static async Task <List <T> > GetObjectListAsync <T>(string dataUrl, AbstractParser <T> parser) { var request = (HttpWebRequest)WebRequest.Create(dataUrl); request.Method = "GET"; var response = await Task.Factory.FromAsync((callback, stateObject) => request.BeginGetResponse(callback, request), request.EndGetResponse, null); using (var reader = new System.IO.StreamReader(response.GetResponseStream())) { string responseText = reader.ReadToEnd(); var lines = responseText.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); var objectList = parser.Parse(lines); return(objectList); } }
public string Value() { return(_parser.Parse()); }
private void Run(AbstractParser parser) => parser.Parse();