web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to combine two entity-reference-collections

(0) ShareShare
ReportReport
Posted on by 645

Hey I have two entity-reference-collections and I need to combine/merge/unite them into one, How can I do that?

*This post is locked for comments

I have the same question (0)
  • Guido Preite Profile Picture
    54,086 Moderator on at

    which is your exact requirement?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Sahara,

    Like Guido asked, what exactly is your requirement.

    Adding to collection can be easily done using AddRange of a collection in .net code:

    List<EntityReference> list1 = new List<EntityReference>();

    List<EntityReference> list2 = new List<EntityReference>();

    Option 1:

    list2.AddRange(list1);

    Option 2:

    EntityReferenceCollection entityReferenceCollection = new EntityReferenceCollection(list1);

    entityReferenceCollection.AddRange(list2);

    You can play around with this as there are a lot of other options...

    Hope this helps.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    Please provide your  specific requirement with scenario which will help to get clear answer from people here.

    I am assuming you want to merge entity collection in that case  there should be  some condition before merge, so you need to loop through one entity collection using .NET LINQ merge another entity reference based on conditions.

    If you want to simply add another same list of entity collection you can simply use -

    entCollection1.AddRange(listentCollection12);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans