Solved

Linq Contains Operator no working

Posted on 2014-09-02
3
106 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 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