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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:02:38+00:00 2026-06-15T13:02:38+00:00

I have nested classes ie Order ID, (GUID = 8e6e48f7-9047-4e2a-95e7-ec4318641fbb) Date Orders -> List<OrderItem>

  • 0

I have nested classes ie

Order

ID, (GUID = 8e6e48f7-9047-4e2a-95e7-ec4318641fbb)
Date
Orders -> List<OrderItem>

OrderItem

ID, (GUID= = 4582234b-d8b5-4665-b00f-e4f09ff3e2c6)
ProductId
Qty
Unit
Price
ID, (GUID= = b0d12322-e92c-42c6-b2b7-520db1d3a818)
ProductId
Qty
Unit
Price

Because I have nesting and I am using GUIDs as IDs for my objects, I am wondering whether there is a generic method to find an object given a GUID. One I have this object I could then remove it from it parent list.

By the way, I do realise that I could used specific lambda expression to get at the specific objects, but this would result in many expressions for many different scenarios, hence many interest in one generic approach.

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-06-15T13:02:39+00:00Added an answer on June 15, 2026 at 1:02 pm

    I would probably create an interface that all of my classes (or base classes) would implement called IGuidSearchable or something like that. It would need to set two properties, the ID and a Children collection of List<ISearchable>. The implementing classes could either use this or would be responsible for setting this property to be equal to the property they use (like Orders -> List<OrderItem> in your example).

    public static IGuidSearchable FindObjectByGuid(this IGuidSearchable source, System.Guid guid) 
    {
        if (source.ID.Equals(guid)) 
        {
            return source;
        }
        foreach (ISearchable child in source.Children)
        {
            if (child.FindObjectByGuid(guid) != null)
                return child;            
        }   
    
        return null; // Fall through    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of questions relating to nested classes within Java. How do
I have nested list of the following form: my_list = [['Some1', '2', '3.6', '4.5',
I have a nested drag and drop list which return json formattet string. I
how to implement inner outer classes in c# i have two nested classes like
I have a three nested classes, Show, Season and Episode, where a show has
I have a Java problem with nested classes. My first class structure looked like
I've got several nested classes, with the following structure: BackupLocation contains list of BackupClients
This is the scenario: I have nested classes and need to serialize then in
I have several models that includes nested classes and lists. Many of the class
I have a class that I writes iCal events, and it contains nested classes

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.