0

In the first query, I query list of steps for an ID. In the next query I check to see if that query contains an ID from new Query and C_S_Is_Button. But I get this error below. I have seen similar issues on this site but I havent figured out how to implement a solution into my problem.

Error:

The type arguments for method 'System.Linq.Enumerable.Contains(System.Collections.Generic.IEnumerable, TSource)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

First Query

var QcheckA = from csd in l.LCSDatas
                join cls in l.LCSteps on csd.C_S_ID equals cls.C_S_ID
                join cde in lol.LCDefinitions on csd.C_S_ID equals cde.C_S_ID
                where csd.A_ID == _AID && cde.C_ID == data.C_ID
                select new 
                {
                    csd.C_S_ID
                };     

C Step. Find lowest step where button hasnt been clicked.

var QSID = (from cd in l.LCDefinitions
               join cs in l.LCSteps on cd.C_S_ID equals cs.C_S_ID                           
               where cs.C_S_Is_Button == true
                  && cd.C_ID == data.C_ID                              
                  && !QcheckA.Contains(cd.C_S_ID) //Error Here
               orderby cd.C_S_Order ascending
               select new
               {
                   cd.C_S_ID
               }).Take(1);

var SID = QSID.SingleOrDefault();

Any suggestions for this situtation? Thanks

2
  • 1
    Got to be some of the most unhelpful variable names of all time Commented Jun 18, 2012 at 23:10
  • Yeah I changed them to post it here. In main code it has better Variable names. Commented Jun 19, 2012 at 13:36

1 Answer 1

2

You are creating an anonymous type in the first query and then in the second query you are trying to essentially compare an anonymous class type to a base type like an int or a Guid.

In your first query try to be more explicit (cast it to the exact type it is, I'm assuming int but you might be using a Guid):

select new  
{ 
    ID = (int)csd.C_S_ID 
};     

Then, in your second query, create another anonymous type that is like the first being explicit on what type of property it contains:

&& !QcheckA.Contains(new { ID = (int)cd.C_S_ID} ) 
Sign up to request clarification or add additional context in comments.

1 Comment

The error message went away so now I just need to test. Thanks for the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.