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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:59:57+00:00 2026-06-14T05:59:57+00:00

I have a first list of entities like this : public partial class Networking

  • 0

I have a first list of entities like this :

public partial class Networking :EntityBase
{

    public virtual int NetWorkingId
    {
        get;
        set;
    }

    public virtual string NetWorkingParam
    {
        get;
        set;
    }

    public virtual System.DateTime NetWorkingDate
    {
        get;
        set;
    }
}

And I have a second list of entities like this:

public partial class PrivateNetwork :EntityBase
{
    public virtual int PrivateNetworkId
    {
        get;
        set;
    }

    public virtual int ContaId
    {
        get { return _contaId; }
        set
        {
            if (_contaId != value)
            {
                if (Contact != null && Contact.ContaId != value)
                {
                    Contact = null;
                }
                _contaId = value;
            }
        }
    }

    public virtual Nullable<System.DateTime> DateCreation
    {
        get;
        set;
    }
}

I want to collect these two lists in one and sort all the elements by date.

Is that possible ?

  • 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-14T05:59:58+00:00Added an answer on June 14, 2026 at 5:59 am

    This problem could easily be solved by using polymorphism; use a common base class or interface for both classes, which has the DateTime property you want to sort on.

    Example:

    public abstract class NetworkingBase : EntityBase
    {
        public DateTime DateToSortOn { get; set; }
    }
    

    or

    public interface INetworking
    {
        public DateTime DateToSortOn { get; set; }
    }
    

    And then make your classes derive from NetworkingBase or implement INetworking:

    public partial class Networking : NetworkingBase
    {
        ...
    }
    
    public partial class PrivateNetwork : NetworkingBase
    {
        ...
    }
    

    or

    public partial class Networking : EntityBase, INetworking
    {
        ...
    }
    
    public partial class PrivateNetwork : EntityBase, INetworking
    {
        ...
    }
    

    Do a LINQ Union or Concat and then an OrderBy on the resulting collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Public Shared Function GetAvailableManufacturers() As List(Of Manufacturer) 'first get
Q: I have a list of objects like this: List<object> entities = GetallEntities(); The
If you have a standard ordered list in HTML like: <ol> <li>First</li> <li>Second</li> <ol>
I have two questions, actaully... First off, Why cant I do this: List<Object> object
I have a list of entities like below. Entity1 { Id=1, From=01/01/2011, To=31/01/2011, Status=true
I have a linked list class that stores a linked collection of entities. I've
I'll let the code do the talking here, I have something like this: class
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I have two list on my request on jsp. First one is productGroupName, and
I have a list of objects of type A. In a first iteration I

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.