How to print Address of a method in c#?

后端 未结 2 1089
不知归路
不知归路 2021-01-29 02:04

In C Programming,

void foo()
{
}
void main()
{
  printf(\"%p\",foo);
}

will print the address of foo function. Please let me know if there is a

2条回答
  •  悲哀的现实
    2021-01-29 02:11

    In C# methods don't provide address. In C method addresses are available to create pointers to functions that can be used to alternatively call functions by passing them to functions that accept these pointers. In C# you could achieve the same using delegates that are typesafe and these delegates can contain multiple functions too...

提交回复
热议问题