我正在将代码从C ++转换为C#。我有这条线:
typedef bool (*proc)(int*, ...);
我可以在C#中做到吗?
简短的回答:是的。
通常:(
未经测试...只是大纲)
{
bool AFunction(ref int x, params object[] list)
{
/* Some Body */
}
public delegate bool Proc(ref int x, params object[] list); // Declare the type of the "function pointer" (in C terms)
public Proc my_proc; // Actually make a reference to a function.
my_proc = AFunction; // Assign my_proc to reference your function.
my_proc(ref index, a, b, c); // Actually call it.
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句