Casting a System.__ComObject in C# via reflection

后端 未结 2 1039
梦毁少年i
梦毁少年i 2021-01-03 03:38

I\'m attempting to cast a System.__ComObject to an interface type using reflection. I have tried using Convert.ChangeType(Object,Type) but c# then

2条回答
  •  一生所求
    2021-01-03 04:41

    For any object to be type casted you need to be sure it belongs to that particular type. You can verify thisfirst by checking using "is" operator. http://msdn.microsoft.com/en-us/library/scekt9xw%28VS.71%29.aspx

提交回复
热议问题