linq where in 查询

在linq 中实现 sql 中的in查询时,可以使用如下语句:

View Code

 /// 
        
 
        
 
        
 
         intPropertySetId)
 )
 ();
            }
 
 Ls.ToList();
<summary>/// 根据行业id获得属性集名
        
///</summary>///<param name="strPropertySetId"></param>///<returns></returns>public List<string> GetHyNametByPromotionForWeb(List<int?>        {
            
if (intPropertySetId.Count ==0            {
                
returnnew List<string>            var Ls = from p in _content.OP_Catalog
                     
where intPropertySetId.Contains(p.HYID) && p.parentCID =="0"                     select p.catalogName;
            
return        }

 

注意:类型要一致

 

 

 

posted on 2011-07-29 14:38  wtq  阅读(5302)  评论(0编辑  收藏  举报