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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:08:32+00:00 2026-06-07T18:08:32+00:00

I have lists of two Shapes – Rectangles and Circles. They both share 3

  • 0

I have lists of two Shapes – Rectangles and Circles.
They both share 3 common properties – ID , Type and Bounds

Circles have 2 extra properties – Range and Center

How can i join lists of each type into a single list so i can iterate over them so i don’t have to type two foreach cycles

Could this be donne in a better way than combining the lists ?

public interface IRectangle
{
    string Id { get; set; }
    GeoLocationTypes Type { get; set; }
    Bounds Bounds { get; set; }
}

public class Rectangle : IRectangle
{
    public string Id { get; set; }

    public GeoLocationTypes Type { get; set; }

    public Bounds Bounds { get; set; }
}


public interface ICircle
{
    string Id { get; set; }
    GeoLocationTypes Type { get; set; }
    Bounds Bounds { get; set; }
    float Radius { get; set; }
    Coordinates Center { get; set; }
}

public class Circle : ICircle
{
    public string Id { get; set; }

    public GeoLocationTypes Type { get; set; }


    public Bounds Bounds { get; set; }

    public float Radius { get; set; }

    public Coordinates Center { get; set; }
}

public class Bounds
{
    public Coordinates NE { get; set; }

    public Coordinates SW { get; set; }
}

public class Coordinates
{
    public float Lat { get; set; }

    public float Lng { get; set; }
}
  • 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-06-07T18:08:33+00:00Added an answer on June 7, 2026 at 6:08 pm

    Make both IRectangle and ICircle inherit from a shared type – say IShape.

    A List<IShape> will then be able to take any IRectangle and ICircle types and their inheriting types.

    Since both IRectangle and ICircle share a number of properties, you can do this:

    public interface IShape
    {
        string Id { get; set; }
        GeoLocationTypes Type { get; set; }
        Bounds Bounds { get; set; }
    }
    
    public interface ICircle : IShape
    {
        float Radius { get; set; }
        Coordinates Center { get; set; }
    }
    
    public interface IRectangle : IShape
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Lists of dictionaries. Both are not not null. How to merge
I have two Lists, they look like this <List> ads [0] Headline = Sony
I have two lists. They are sortable but not connected (elements of list one
I have two lists A and B, at the beginning of my program, they
I have two lists of the same type. That type does not have an
I have two lists of different PageTypes - NewsItems and PressReleases. They are displayed
I have two lists that are already sorted how they need to be, and
I have two lists. Ex: List<string> expected = new List<string>(); expected.Add( a ); expected.Add(
I have two lists: [a, b, c] [d, e, f] I want: [a, d,
We have two lists: a=['1','2','3','4'] b=['2','3','4','5'] How to get a list with elements that

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.