Solved

Linq Contains Operator no working

Posted on 2014-09-02
3
92 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
Comment Utility
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
Comment Utility
adull. I should of known, thanks.
0
 
LVL 62

Expert Comment

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

6 Experts available now in Live!

Get 1:1 Help Now