2017-04-24 81 views
0

就像你在我的圖片中看到的,我在桌子上有一張桌子,我該如何解決這個問題?LINQPad 4中的C#表中的表格

Picture

我這樣做,用C#語句。

var testGR = (from doc in DocumentTypes select new { doc.PIMID, documentTypeLabel = from docLabel in doc.DocumentTypeLabels select new {docLabel.Name}}); testGR.Dump(); 

如何更改我的代碼以獲得像圖片中的結果?

回答

0

這聽起來像你想的:

var testGR = 
    from doc in DocumentTypes 
    select new 
    { 
    doc.PIMID, 
    documentTypeLabel = doc.DocumentTypeLabels.FirstOrDefault (l => l.Name) 
    }; 

testGR.Dump();