可以在vb.net中做内联功能吗? [英] is it possible to do inline function in vb.net?

查看:37
本文介绍了可以在vb.net中做内联功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题在标题中

推荐答案

内联是CLR(JIT)的责任,对于何时内联函数有一些条件:

Inlining is the responsibility of the CLR (JIT) and there are some conditions as to when a function is inlined:

  1. 代码大小小于32个字节的IL.
  2. 该函数不包含复杂"结构,例如循环,切换等.
  3. 该函数不包含try/catch/finally.
  4. 该函数未声明为虚拟函数.

您可能会发现,就代码而言,32个字节不是非常,它适用于快速而小型的if-else条件测试,属性获取器/设置器.我认为通过内联大量代码无法获得任何速度.

As you will probably find out, 32 bytes is not very much in terms of code, it is suitable for quick and small if-else condition testing, property getters/setters. I don't think you can gain any speed from inlining a bigger amount of code.

这篇关于可以在vb.net中做内联功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆