Solved

Linq Contains Operator no working

Posted on 2014-09-02
3
94 Views
Last Modified: 2016-02-15
Not sure why I am not returning
 var testType = new string[] { "1,3,10,11,12,13,17" };


var GetString = atesttype.Load()
                .Where(e => e.TypeID == 1 && e.Active == true && testType.Contains(e.Type.ToString()))
.Select(v => new { v.ship }).ToList().Distinct();

Example
select ship from atesttype where typeid =1 And Active = 1 and TestType in (1,3,10)

Open in new window

0
Comment
Question by:sevensnake77
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 40300196
Hi sevensnake77;

I think you meant to assign the array testType as follows having 7 elements and NOT one element in the array with one long string.

var testType = new string[] { "1","3","10","11","12","13","17" };

Open in new window

0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 40300946
adull. I should of known, thanks.
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 40300955
Not a problem sevensnake77, glad I was able to help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now