Exemplo n.º 1
0
        private async Task <SearchBlock> CreateSearchBlock <T>(string title, Uri url, long totalCount,
                                                               IEnumerable <T> items,
                                                               Func <T, string> getTitle, Func <T, Uri> getUrl, Func <T, Task <string> > getDesc)
        {
            var block = new SearchBlock(title, url, totalCount);

            foreach (var item in items)
            {
                block.AddItem(getTitle(item), getUrl(item), await getDesc(item));
            }
            return(block);
        }
        protected SearchBlock CreateSearchBlock <T>(string title, Uri url, long totalCount,
                                                    IEnumerable <T> items,
                                                    Func <T, string> getTitle, Func <T, Uri> getUrl, Func <T, string> getDesc, Func <T, DateTimeOffset> getDate)
        {
            var block = new SearchBlock(title, url, totalCount);

            foreach (var item in items)
            {
                block.AddItem(getTitle(item), getUrl(item), getDesc(item), getDate(item));
            }

            return(block);
        }