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 981499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:33:06+00:00 2026-05-16T04:33:06+00:00

I have a List, and I would like to compute a double[360] containing the

  • 0

I have a List, and I would like to compute a double[360] containing the maximum range along each bearing (to the nearest degree). One hitch is that the chart plotting software I’m using requires each degree to be populated with no holes.
I’m aware of the MoreLinq Batch extension, though not quite sure how to use it…

Heres the code I have so far:-

List<PolarCoords> plots = ...;
double chartVals = new double[360]; // unused degrees will be zero

double MaxRangesByDegree = from polar in plots let angle = RadToDeg(polar.Bearing)
                           group plot by angle into degreeBuckets
                           orderby degreeBuckets
                           select MaxRange = (from polar2 in degreeBuckets select polar2.SlantRange).Max().ToArray()

// somehow merge chartVals and MaxRangesByDegree so no holes

I’m probably trying to bite off too much with a single query, and could certainly do it with a simple for loop, but it’s a good exercise for learning LINQ:-) At the moment the code is throwing a SystemException: At least one object must implement IComparable…

  • 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-16T04:33:06+00:00Added an answer on May 16, 2026 at 4:33 am
    var plotsByDegree = plots.ToLookUp(polar => RadToDeg(polar.Bearing));
    
    return Enumerable.Range(0,360)
                     . Select(degree => plotsByDegree.Contains(degree) ? plotsByDegree[degree].Max (polar => polar.SlantRange) : 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a
I have a list of custom objects List and I would like to update
I would like to have a list of all the time zones available on
I have a list of objects and I would like to access the objects
I have a list of elements which I would like to make sortable and
Let's say I have a list of domain names that I would like to
I have a List<List<int>> . I would like to convert it into a List<int>
I have a List of object, produced by JPA q.getResultList() . I would like
I have a dropdown list (FK) which I would like to set and display
I have an ordered list in HTML. I would like to add styling only

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.