# Nest returning results as IReadOnlyCollection, how to change it so it is usable?

**URL:** <https://discuss.elastic.co/t/nest-returning-results-as-ireadonlycollection-how-to-change-it-so-it-is-usable/284512>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 17, 2021, 7:40pm UTC](https://discuss.elastic.co/t/nest-returning-results-as-ireadonlycollection-how-to-change-it-so-it-is-usable/284512 "2021-09-17T19:40:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bensalerno](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@bensalerno](https://discuss.elastic.co/u/bensalerno)\
**Post date:** [September 17, 2021, 7:40pm UTC](https://discuss.elastic.co/t/nest-returning-results-as-ireadonlycollection-how-to-change-it-so-it-is-usable/284512/1 "2021-09-17T19:40:31Z")

</div>

Using elasticsearch, I'm trying to add my hit results into a list after they are returned, like this:

```auto
var lstModels = new SearchResult<mdl.Event>();

var searchResponse = Event.client.Search<mdl.Event>(s => s
                    .Query(q => q
                        .QueryString(qs => qs
                            .Query(search.Text))
                        && q
                        .DateRange(r => r
                            .Field(f => f.CreatedTimeStamp)
                            .GreaterThanOrEquals(search.From)
                            .LessThanOrEquals(search.To))));
                lstModels.AddItems(searchResponse.Hits);

```

However I am getting an error saying that my types are incompatible.

```auto
cannot convert from 'System.Collections.Generic.IReadOnlyCollection<Nest.IHit<Event>>' to 'System.Collections.Generic.IEnumerable<Event>'

```

Why are my hits returning as part of the Read Only Collection? Is there a way to change this so that they are usable?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 15, 2021, 7:41pm UTC](https://discuss.elastic.co/t/nest-returning-results-as-ireadonlycollection-how-to-change-it-so-it-is-usable/284512/2 "2021-10-15T19:41:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
