需要反射时使用dynamic
生活随笔
收集整理的這篇文章主要介紹了
需要反射时使用dynamic
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
//使用dynamic的寫法 dynamic fileExplorerData = _currentFolder.FileExplorerData; var data = fileExplorerData.InsertFromPath(newPath);//使用反射的寫法 MethodInfo InsertMethod = _currentFolder.FileExplorerData.GetType().GetMethod("InsertFromPath"); var fileExplorerData = InsertMethod.Invoke(_currentFolder.FileExplorerData, new object[] { newPath }); var data = fileExplorerData as FileExplorerData;
?
轉載于:https://www.cnblogs.com/xiaokang088/archive/2013/01/07/2848628.html
總結
以上是生活随笔為你收集整理的需要反射时使用dynamic的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《你不可不知的人性》讲述了什么?书籍《你
- 下一篇: 驴多少钱一头啊?