class Program
{
    static void Main(string[] args)
    {
        dynamic d = Activator.CreateInstance(typeof(DemoType));

        object o = d.ToString();

        Console.WriteLine(o);

        Console.WriteLine(d.Value);
    }
}


class DemoType
{
    public override string ToString()
    {
        return "Hello World";
    }


    public int Value
    {
        get
        {
            return 100;
        }
    }
}

相关文章:

  • 2021-08-25
  • 2021-06-15
  • 2021-06-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-09-14
猜你喜欢
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-02-27
相关资源
相似解决方案