使用类型对象或字符串类型铸造
我正在寻找一种使用字符串或类型对象将我的类类型转换为特定对象的方法。例如,请参阅我的下面简单代码段:
int i = 10;
Type t = i.GetType();
string str = typeof(t) i;
它说t是一个无法用作类型的杂质。我的问题是,无论如何都可以做这件事吗?
I am looking for a way to convert my class type into a specific object using a string or Type object. For instance see my below simple code snippet:
int i = 10;
Type t = i.GetType();
string str = typeof(t) i;
It saying that t is a varialbe which cannot used as a type. My question is that is there anyway to do this thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是演员和转换的示例:
Here is an example of a cast and a convert: