Solved

Linq Contains Operator no working

Posted on 2014-09-02
3
97 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 63

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 63

Expert Comment

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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

778 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