开发者

Silverlight - Is there a performance difference between C# and VB.net Event Handlers?

开发者 https://www.devze.com 2023-03-16 14:33 出处:网络
Being new to both .NET and Silverlight, I have noticed t开发者_开发技巧hat many of the tutorials for Silverlight (Tim Heuers Blog, Silverlight TV etc) are in C#. I know that the general difference bet

Being new to both .NET and Silverlight, I have noticed t开发者_开发技巧hat many of the tutorials for Silverlight (Tim Heuers Blog, Silverlight TV etc) are in C#. I know that the general difference between VB and C# is usually preference.

However one of the major differences I had noticed was the way C# and VB.NET handle events. Is this just a syntactical difference, or is one or the other optimized to handle events better? For example, they both get compiled down to the same Intermediate Language, but is the code that is generated identical? Seeing as Silverlight relies on this heavily, I thought it might be worth consideration.

Considering the expertise on this forum, I was wondering if anyone has done research into this, or performance testing.


The code that gets generated may not be identical down to the instruction, but the overall effect is the same. You should not see a performance difference in that area.

VB.NET has two syntaxes for events - AddHandler, which is the same as C#'s +=, and Handles, which is just syntactic sugar for AddHandler in a constructor.


They both get compiled to IL (or in this case Silverlight bytecode) and should perform exactly the same. Any differences should be just syntactical.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号