sql server - what's the catch (select new in LINQ vs simply filling the object) -


Anyone can understand the difference between these two pieces of code:

  var Temp = (In context, select some fresh new objects from C. {name = c.Name, created = c. Created}). ToList ();  

And this:

  var temp = (c in the selection from c.) Some selection; Forech (template in some tape) {SomeObject then = new object (); So.Name = t.Name; Hence. Created = t. ready; }  

Some table.Created databases have a ductable datetime type field in the database.

While the first piece throws an exception:

  Sqldatetime overflow 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM Should be between.  

The second works.

Thank you!

In the first code, type c by nothingtable Will be read or an example of SomeObject will be created unless any code is Temp .

The second is the calculation.

So I hope that there is a problem with the validity of context.setable first code has been computed in temporary .

Test it by changing the first block on it:

  var temp = (from context to c) select something new object {name = c.Name , Created = c.Created}) .Olist ();  

Which emphasizes immediate calculation.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -