是否有可能通过反射来调用值类型运营商? [英] Is it possible to call value type operators via reflection?
本文介绍了是否有可能通过反射来调用值类型运营商?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于C#例如运营商+,+ =,==是重写。它让我觉得自己是那种方法,因此不知道是否有一种方法使用反射,上的Int32比如给他们打电话。
As C# operators e.g. +, +=, == are overridable. It lets me think they are sort of methods, thus wonder if there is a way to call them using reflection, on Int32 for instance.
推荐答案
是的,运营商定制是可调用使用反射(他们有特殊的名称,如op_Addition),但System.Int32没有具体定义,为根本,内置的类型直接由IL操作码如<$处理C $ C>添加,而不是方法调用。
Yes, the custom operators are invokable using reflection (they have special names, such as op_Addition), but System.Int32 doesn't define them, as fundamental, built-in, types are handled directly by IL opcodes like add
, rather than method calls.
这篇关于是否有可能通过反射来调用值类型运营商?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文