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

后端 未结 4 2035
佛祖请我去吃肉
佛祖请我去吃肉 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:12

    It is not possible to cast to a type not known at compile-time.

    Have a look at the .NET 4.0 dynamic type.

提交回复
热议问题