Per esempio, la differenza tra questo codiceQual è la differenza tra l'utilizzo solo di asynс Task e Task?
public Task<IList<NewsSentimentIndexes>> GetNewsSentimentIndexes(DateTime @from, DateTime to = new DateTime(), string grouping = "1h")
{
var result = _conf.BasePath
.AppendPathSegment("news-sentiment-indexes")
.SetQueryParams(new
{
from = from.ToString("s"),
to = to.ToString("s"),
grouping
});
return result
.GetStringAsync()
.ContinueWith(Desereialize<IList<NewsSentimentIndexes>>);
}
e che
public async Task<IList<NewsSentimentIndexes>> GetNewsSentimentIndexes(DateTime @from, DateTime to = new DateTime(), string grouping = "1h")
{
var result = _conf.BasePath
.AppendPathSegment("news-sentiment-indexes")
.SetQueryParams(new
{
from = from.ToString("s"),
to = to.ToString("s"),
grouping
});
var newsStr = await result.GetStringAsync();
return JsonConvert.DeserializeObject<NewsSentimentIndexes>(newsStr);
}
Qual è corretto o lavorare più velocemente? E basta chiamare questo metodo è necessario attendere o solo un compito?
Dimmi per favore come essere un WaitAll e il loro seguito. E' impossibile utilizzare l'attendono –
'Task.WaitAll ( _newsService.GetAll (DateTime.Now.AddYears (-1), a: DateTime.Now) .ContinueWith (ContinuationAction), _tradingPairService.GetAllExchangeTradingPairAsync (ExchangeId, TradingPairId) .ContinueWith (ContinuationAction), _companyTypesService.GetAll(). ContinueWith (ContinuationAction)); ' –
Ho letto il tuo blog grazie, ma devi WaitAll example, con le stesse attività. Con la continuazione dello stesso –