Type casting in c# using the string name of the object type

后端 未结 4 2025
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 19:42

I have the following code, should be easy to follow through

public class Foo
{
    public void FooHasAMethod()
    {
        Console.WriteLine(\"it is me, fo         


        
4条回答
  •  日久生厌
    2021-01-05 20:10

    There's no way to cast by using string. But you can use dynamic, or MethodInfo with invoke

提交回复
热议问题