0

linq リクエストがあります。選択する必要がitem.Titleあります。どうやってこれをしますか?

var list = (from item in answer.SubItems.OfType<TItemView>()
            where item.SubItems != null
            from ty in item.SubItems
            select ty as TDealRequestView
                into request
                select new
                {
                    itemTitle = item.Title,//item not visible 
                    Title = request.Title,

                }).ToList();
4

3 に答える 3

1

キーワードを使用できます:let

in order to initialize your value request.Title

let request = your treatment... (request is local variable of your query)
于 2012-07-02T15:48:48.450 に答える
1

今は確認できませんが、試してください:

String title;

var list = (from item in answer.SubItems.OfType<TItemView>()
        where item.SubItems != null
        let title=item.title 
        ...

        //now use title
于 2012-07-02T15:49:27.693 に答える
1

交換:

select ty as TDealRequestView
            into request

と:

let request = ty as TDealRequestView
于 2012-07-02T15:49:36.500 に答える