Home > Backend Development > C++ > Can C# Call a Function from a String?

Can C# Call a Function from a String?

DDD
Release: 2025-01-26 02:09:08
Original
312 people have browsed it

Can C# Call a Function from a String?

In the string call function

PHP can call the function by the function name stored in the string. For example:

.NET can achieve this function?
<code class="language-php">$function_name = 'hello';
$function_name();

function hello() { echo 'hello'; }</code>
Copy after login

Yes.

It can be used to achieve this function. The method is as follows:

Please note that the method of being called must have a public access decoration. For non -public methods, please use bindingflags parameters:

The above is the detailed content of Can C# Call a Function from a String?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template