Getting the name of a delegate

Good day everyone!

I have a class with a property that gets set to a delegate method, I would like to get the name of this method in the form of a string/text.

In the debugger, I am able to find the name under “Delegate Members” by clicking on the delegate method property and then clicking on “Contents”.

Does anyone know a way to programmatically get this string?

Thanks!

In general, this is the kind of think you can do with https://documentation.xojo.com/index.php/Introspection

Whether Introspection can get the name of a Delgate, I’m not sure. What have you tried?

[quote=399305:@Michael Diehr]In general, this is the kind of think you can do with https://documentation.xojo.com/index.php/Introspection

Whether Introspection can get the name of a Delgate, I’m not sure. What have you tried?[/quote]

I tried to use introspection, both MethodInfo and PropertyInfo. I wasn’t able to make any headway on it.

Yeah, I just tried a simple test, and it doesn’t work:

Delegate Foo(x as integer, y as integer)
Method Bar(x as integer, y as integer)

App.Open
   DoDelgate (addressOf Bar)

Sub DoDelegate(f as Foo)
  dim t as Introspection.TypeInfo = Introspection.GetType(d)
  dim a() as Introspection.AttributeInfo = t.GetAttributes
  dim c() as Introspection.ConstructorInfo = t.GetConstructors
  dim m() as Introspection.MethodInfo = t.GetMethods  
  dim p() as Introspection.PropertyInfo = t.GetProperties
  break
  MsgBox t.FullName

displays “Delegate”

[quote=399308:@Michael Diehr]Yeah, I just tried a simple test, and it doesn’t work:

Delegate Foo(x as integer, y as integer)
Method Bar(x as integer, y as integer)

App.Open
   DoDelgate (addressOf Bar)

Sub DoDelegate(f as Foo)
  dim t as Introspection.TypeInfo = Introspection.GetType(d)
  dim a() as Introspection.AttributeInfo = t.GetAttributes
  dim c() as Introspection.ConstructorInfo = t.GetConstructors
  dim m() as Introspection.MethodInfo = t.GetMethods  
  dim p() as Introspection.PropertyInfo = t.GetProperties
  break
  MsgBox t.FullName

displays “Delegate”[/quote]

Yes, I got the same result.