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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:32:52+00:00 2026-06-11T23:32:52+00:00

I have the following class: public class OrgAlertList { public string CustMailName { get;

  • 0

I have the following class:

public class OrgAlertList
{
    public string CustMailName { get; set; }

    /// <summary>
    /// Gets all the alerts that apply to this customer.
    /// </summary>
    public virtual IEnumerable<OrgAlertSummary> Alerts { get; set; }
}

That contains a property (named Alerts) that is an IEnumerable of my second class:

public class OrgAlertSummary
{
    /// <summary>
    /// Message detailing the alert for the user.
    /// </summary>
    public string Message { get; set; }

    /// <summary>
    /// Message detailing how to fix alert.
    /// </summary>
    public string ActionMessage { get; set; }
}

The Alerts property in the OrgAlertList can contain zero to many OrgAlertSummary items.

I need to write a Lambda expression, or use a LINQ query, to flatten the classes into a new type that has the CustMailName, Message, and ActionMessage in it for each OrgAlertList item where the Alerts property contains at least one OrgAlertSummary item. Can anyone help with this?

  • 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-11T23:32:53+00:00Added an answer on June 11, 2026 at 11:32 pm

    Try this: (untested)

    var q = from orgAlert in myOrgAlertList
            from orgAlertSummary in orgAlert.Alerts
            select new { orgAlert.CustomMailName, 
                         orgAlertSummary.Message, 
                         orgAlertSummary.ActionMessage};
    

    Assuming myOrgAlertList is some sort of IEnumerable<OrgAlertList>

    This query will create an anonymous type with fields named CustomMailName, Message, and ActionMessage. If you intend to export this resulting list to other modules, it’s recommended to define your own class and create it in the select instead of using an anonymous type.

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

Sidebar

Related Questions

I have the following class public class UIControl { public string FName{ get; set;
I have the following class: public class Movie { string Name get; set; string
I have the following class: public class EmailData { public string FirstName{ set; get;
I have the following class: public class ExternalClass { public string Name {get;set;} public
I have the following class public class MenuVeiculo { public string Nome { get;
I have the following class public class CountrySpecificPIIEntity { public string Country { get;
I have the following class public class CountrySpecificPIIEntity { public string Country { get;
I have the following class public class Account { IEnumerable<AccountData> Data { get; set;
I have the following class: public class Category { public string Name { get;
I have this following class: public class TV { public string GroupId { get;

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.