Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:23:42+00:00 2026-05-25T15:23:42+00:00

I have a class defined as below. public class Risk { public DateTime RiskDate

  • 0

I have a class defined as below.

public class Risk
{
   public DateTime RiskDate { get; set;}
   public string RiskStatus { get; set;}    
}

And I have a List of Risk as below

RiskDate RiskStatus

10/10/2001 High

15/10/2001 Low

21/10/2001 High

28/10/2001 Low

05/11/2001 High

08/11/2001 Low

I would like to find the date range from the list for a given date. For example, if my input date is 17/10/2001 then I would like to pull 15/10/2001 and 21/10/2001 from the list. If my input date is an exact match to the list, for example 28/10/2001, then I would like to pull only that date from the list.

I hope someone can advice me on this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:23:43+00:00Added an answer on May 25, 2026 at 3:23 pm

    This works:

    var lower =
        from d in dates
        where d <= inputDate
        orderby d descending
        select d;
    
    var upper =
        from d in dates
        where d >= inputDate
        orderby d
        select d;
    
    var range = lower.Take(1)
        .Concat(upper.Take(1))
        .Distinct();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a base class, defined as below (I'm also using DevExpress components): public
Lets say I have model inheritance set up in the way defined below. class
I have a simple class as defined below: public class Person { int _id;
I have an interface defined as below: public interface TestInterface{ int id { get;
I have defined two classes below: public class junk { private BigInteger a =
I have an example class defined like below: public class FooBar { void method1(Foo
I have the class defined as below public partial class School { public StudentDetails
I have an interface and a class defined as below public interface IShape {
I have a class defined as below: ref class myClass { PictureBox^ pic2; public:
I have 2 custom controls as defined below: public class Icon : Control {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.