What is the method variable? in C# -


i use c#.

when defined hoge method below,

void hoge(bool isbar){} 

i hoge method below

var methodname = this.hoge action<bool>).method.name; 

however, can't understand this.hoge type. because, can assign , casting.

but, can't give me method name directly. this.hoge.method.name;

and, error. typeof(this.hoge)

what method variable exactly?

the code provided isn't valid c# code, it's difficult understand you're asking. think you're trying understand how expression this.hoge translated can provide name of method.

if so, code example should this:

var methodname = ((action<bool>)this.hoge).method.name; 

and implicitly create instance of delegate type (in case, of type action<bool>), if you'd written this:

var methodname = new action<bool>(this.hoge).method.name; 

and of course, once have delegate type, type has method property, returns methodinfo object in turn, of course, has name property.


if not you're asking, please improve question providing valid, compilable c# example of you're asking about, along more precisely worded question code.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -