using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
student student1=new student();
student1.Name = "test1";
EventHandler deleHandler1 = student1.TestValue;
deleHandler1.Invoke(null,null);
IntPtr testValueIntPtr1 = deleHandler1.Method.MethodHandle.GetFunctionPointer();
Console.WriteLine(testValueIntPtr1);
student student2 = new student();
student2.Name = "test2";
EventHandler deleHandler2 = student2.TestValue;
deleHandler2.Invoke(null, null);
IntPtr testValueIntPtr2= deleHandler2.Method.MethodHandle.GetFunctionPointer();
Console.WriteLine(testValueIntPtr2);
FieldInfo
Console.ReadKey();
c# 获得方法的内存地址
最新推荐文章于 2023-12-28 09:32:55 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)