FirstOrDefault() and FirstOrDefault<string>()在LINQ 之间有什么区别?
有人可以给我一些简单的解释吗?
TypedDataSet ds= codeComponent.GetAllCode("test");
string status = (from s in ds.Codes
where s.Name == "hello"
select s.Remarks).FirstOrDefault();
TypedDataSet ds= codeComponent.GetAllCode("test");
string status = (from s in ds.Codes
where s.Name == "hello"
select s.Remarks).FirstOrDefault<string>();
Run Code Online (Sandbox Code Playgroud)