devxlogo

Can’t use the “Between” Keyword in a LINQ Query

Can’t use the “Between” Keyword in a LINQ Query

You can’t use the “Between” keyword in a LINQ query.

The sample snippet below shows how you translate between two date fields.

DateTime fromDate = DateTime.Now.AddMonths(-3); DateTime endDate = DateTime.Now; //linq query var result = from te in datatable.AsEnumerable()                         where (te.Field("Month") = fromDate)                         && (te.Field("Month")
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist