List<DateTime> listdate = new List<DateTime>();
var InList = (from b in mstdocstats
join a in mstdocs on a.docid = b.docid
where a.vtype = 'table'
&& a.DCREA.Month == "06" && a.DCREA.Year == "2016"
select a.docid).ToList();
var listreaddate = (from b in mstdocstats
join a in mstdocs on a.docid = b.docid
where InList.Contains(a.docid) && a.vtaid = '2'
&& a.vtype = 'read'
select new
{
Read_DATE = ((from mstdoc in mstdocs
where
mstdoc.docid == a.docid &&
mstdoc.vtype == "read"
select new
{
mstdoc.DCREA
}).First().DCREA)
}).ToList();
,但我得到一個錯誤報告,C#語言不能轉換列表:無法隱式轉換類型 'System.Collections.Generic.List <AnonymousType#1>' 到 'System.Collections.Generic.List <System.DateTime的>'
"Error:Cannot implicitly convert type
'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<System.DateTime>'
請指引我正確的解決辦法,我怎麼能做到這一點,得益於前...
首先,你不能在同一個方法中定義兩個同名的變量,如'List listdate'和'var listdate'。 –
你有兩次定義相同的變量我的意思是listdate –
好吧,我知道它的變量:) –