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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:21:31+00:00 2026-05-28T02:21:31+00:00

I have a parent child collection objects and was wondering how to get a

  • 0

I have a parent child collection objects and was wondering how to get a single item from the child collection using Linq

Parent Collection

Public Class FaultCodeModel

    Public Property ID As Short
    Public Property Description As String
    Public Property FaultCodeDetails As List(Of FaultCodeDetailModel)

End Class

Child Collection

Public Class FaultCodeDetailModel

    Public Property ID As Short
    Public Property Description As String
    Public Property NotifyPurchasing As Boolean
    Public Property NotifyPurchasingAfterHits As Short
    Public Property NotifyExpediting As Boolean
    Public Property NotifyExpeditingAfterHits As Short
    Public Property NotifyBuyer As Boolean
    Public Property NotifyBuyerAfterHits As Short
    Public Property NotifySupplier As Boolean
    Public Property NotifySupplierAfterHits As Short
    Public Property NotiifyProPack As Boolean
    Public Property NotiifyProPackAfterHits As Short
    Public Property NotifyGoodsInTeamLeader As Boolean
    Public Property NotifyGoodsInTeamLeaderAfterHits As Short

End Class

I have tried the below Linq query but it is returning multiple child items where the parent ID field is matched.

Dim var = From fcd In FaultCodes Where fcd.FaultCodeDetails.Any(Function(w) w.ID.Equals(faultCodeDetailID))
            Select fcd.FaultCodeDetails

How do I get a single item from the child collection?

  • 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-28T02:21:32+00:00Added an answer on May 28, 2026 at 2:21 am
    Dim fcdID = 4711
    Dim fcdm = (From fc In FaultCodes
               From fcd In fc.FaultCodeDetails
               Where fcd.ID = fcdID
            Select fcd).FirstOrDefault
    

    http://msdn.microsoft.com/en-us/library/bb340482.aspx

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

Sidebar

Related Questions

I have two entities: public class Parent() { public ICollection<Child> Children { get; set;
I have three objects. public class ParentClass { public virtual Guid ParentClassId { get;
Let's say I have a simple parent->child class structure as shown below Public Class
I have a Parent/Child object/mapping as follows: class Parent { int Id; string name;
Using parent child relationship where a parent can have children while each child has
I have a parent and child class that both need to implement IDisposable .
I have a view model with a collection of other objects in it. public
I have a parent entity (Treatment) with a collection of child entities (Segments). I
Using mongodb I'm trying to remove a property (_id) from a child collection (ListingFeatures)
I have a parent Obj-C object containing (in a collection) a bunch of objects

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.