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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:06:02+00:00 2026-05-24T11:06:02+00:00

I have an array of custom items and then I have an array of

  • 0

I have an array of custom items and then I have an array of objects object[], returned by a function. This object array is indeed of the same Clients type but it is returned as array of object type (I cannot edit this aspect).

I tried with an explicit cast, but I get an exception at runtime saying: cannot convert object[] to clients[].
My goal, once I have both arrays, would be to remove from one list the items that are present in the other list too and make an union, in order to have a unique list.

var client = getClients().ToArray();           //Is an array of Clients[]
var normalSearch = getDuplicates().ToArray();  //Is an array of object[]


//This what I try to achieve,but being object, I cannot invoke "c.ContactId" (Line 4)
var uni = (from c in normalSearch
           where !(from d in dupes
                   select d.ContactId)
                   .Contains(c.ContactId)
           select c).ToArray();

I know that in Linq Union() could exclude automatically duplicate if a primitive type is used, otherwise an extension has to be developed with custom types. But I have not access to the rest of the code, therefore no possibility to change the logic elsewhere.

  • 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-24T11:06:03+00:00Added an answer on May 24, 2026 at 11:06 am
    getDuplicates().Cast<Client>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of custom objects. MyCustomArr[]. I want to convert this to
I have an array of custom class Student objects. CourseStudent and ResearchStudent both inherit
I'm trying to create a controller for a custom complex object but have some
I have a similar problem with this ( https://wordpress.stackexchange.com/questions/9593/custom-post-type-archive-with-pagination ) and can't really figure
I have list view with custom array adapter. I want to get items click
I have a class with a custom each-method: class CurseArray < Array def each_safe
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have a CKEditor custom plugin I'm trying to write, but need some help
I have a collection of custom entity objects one property of which is an
I'm trying to create a node form for a custom type. I have organic

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.