c# – c # [DllImport] in method, function from dll without declaration


Is it possible somehow in c # to connect a function from dll in the method itself? That is, shove a similar construction into a method (for example, the Main method):

static extern uint QueryFullProcessImageName(IntPtr hProcess, uint flags, StringBuilder text, out uint size);

I understand that most likely it will not be possible to declare a method in a method. Maybe somehow it is possible to call the function directly from dll without declaration ???


Gentlemen @Pavel Mayorov, @Lunar Whisper thanks! Everything turned out with the help of "reflection". Tutor on this link.

Scroll to Top