How can you get the type of an instantiated object and use it to cast a different object in C#?

前端 未结 0 1303
予麋鹿
予麋鹿 2020-12-15 03:56

I\'m trying to cast a base object into a derived object.

Like so:

var castedBaseObject = (randomDerivedObject.GetType())originalBaseObject;


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题