簡體   English   中英

與Linq Where條款相關的問題

[英]Trouble With Linq Where Clause

嗨,我在編寫linq查詢時遇到困難。 不知道在哪里放置我的Where子句。

using (var ctx = DB.Get())
        {
            Interaction = new BindableCollection<InteractionDTO>(
                ctx.Interactions.Select(
                x => new InteractionDTO
                {
                    Indepth = x.Indepth  
                }
                )
           );
        }

我在哪里放置此代碼或如何以與上述語法兼容的方式編寫代碼。 where date>= StartDate.SelectedDate.Value

這樣的事情應該工作

ctx.Interactions.
   .Where(x => x.date >= StartDate.SelectedDate.Value) 
   .Select(x => new InteractionDTO
            {
                Indepth = x.Indepth  
            })

試試這個

            ctx.Interactions
            .where (x=> date >=x.StartDate)
            .Select(x => new InteractionDTO
            {
                Indepth = x.Indepth  
            });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM