本文介绍了关于LINQ //性能的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

有人能告诉我这两种获得想要结果的方法之间的区别吗?



Hi
Can someone tell me the difference between these two ways to get the wanted result?

Dim x1 = db.t_Articles.First(Function(x) x.StorageUnit = "some unit")
Dim x2 = (From x In db.t_Articles Where x.StorageUnit = "some unit").First





谢谢



Thank you

推荐答案

.method private hidebysig static bool  '<main>b__3'(class LinqIl.Article x) cil managed
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
  // Code size       21 (0x15)
  .maxstack  2
  .locals init ([0] bool CS



如果你想向自己证明这一点,你需要做的就是运行ildasm和disassembl你的代码。

If you want to prove this to yourself, all you need to do is run ildasm and disassemble your code.


这篇关于关于LINQ //性能的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 04:52