---
title: "Filter objects inside model class by date"  
description: "Filter objects inside model class by date"  
author: "Anonymous User"  
published: 2014-09-29  
updated: 2014-09-29  
canonical: https://www.mindstick.com/forum/2281/filter-objects-inside-model-class-by-date  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Filter objects inside model class by date

I have a [model](https://yourviews.mindstick.com/view/81334/america-is-reopening-after-corona-lockdown-but-on-swedish-model) object called EventListingResponse like this

```
public class EventListingResponse{    public List<events> result { get; set; }    public int totalResults { get; set; }} public class events{    public string id { get; set; }    public string name { get; set; }    public string startDate { get; set; } //smaple date 2014-03-31T12:30:03}
```

And I am storing [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) in this object like this

EventListingResponse eventListResponse = rGetAllEventList();//data from another function.

[Now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) I want to [filter](https://www.mindstick.com/forum/1176/filter-in-a-xml-file-in-c-sharp) this list so that I can get a list of [events](https://www.mindstick.com/blog/102/events-in-c-sharp) like , -->events from January -->Events from February etc. Can any one point out a good [method](https://www.mindstick.com/forum/166/webservice-method) to accomplish this?

## Replies

### Reply by Sumit Kesarwani

Hi John, \
try this:\

```
var filtered = from item in eventListResponse.result      where
DateTime.Parse(item.startDate) >= DateTime.Parse("your starting
date")  and
DateTime.Parse(item.startDate) <= DateTime.Parse("your ending
date")   select
item;
```


---

Original Source: https://www.mindstick.com/forum/2281/filter-objects-inside-model-class-by-date

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
