Thursday, May 6, 2021

Linq to find the Array values Based on another Array

Dear All,

Please find the below code to find the unique value between 2 JSON Array

 

JSONOriginalValues --> (1,2,3,4,5,6) à Array [6] à Original Values

JSONCompareValues --> (1,2,3,7,8) à Array [5] à  Value to Compare

TO be deleted --> 7,8

TO be Updated --> 1,2,3

TO be created --> 4,5,6 

var tobeUpdated = JSONCompareValues.Where(MembersObj => JSONOriginalValues.Any(partyList => MembersObj.ContactId["fieldname"].ToString().ToLower() == partyList.PartiesContact.ClePartie.ToLower()));

 

                            var tobeDeleted = JSONCompareValues.Where(MembersObj => !JSONOriginalValues.Any(partyList => MembersObj.ContactId["fieldname"].ToString().ToLower() == partyList.PartiesContact.ClePartie.ToLower()));

 

                            var tobeDeleteds = JSONCompareValues.Where(MembersObj => JSONOriginalValues.All(partyList => MembersObj.ContactId["fieldname"].ToString().ToLower() != partyList.PartiesContact.ClePartie.ToLower()));

No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...