有没有一种方法可以将字符串转换为类?我能做还是失败 [英] Is there a way to convert a string to a class? I can do or failing

查看:82
本文介绍了有没有一种方法可以将字符串转换为类?我能做还是失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的东西?

字符串ClaseMia = texbox.Text;

公共类ClaseMia
{

} 


类似的东西

解决方案

您似乎误解了什么是类.

类是一种模板.因此,有字符串类. (如果使用静态标识符,则它将直接实例化到程序主堆栈中的对象)

但是,文本框.文本包含一种不可变的引用类型对象.

https://msdn.microsoft.com/zh-cn/library/system.string%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396


something  like that??

String ClaseMia=texbox.Text;

Public class ClaseMia
{

}


something like that

解决方案

You seems to misunderstand what a class is. 

A class is a kind of template. Therefore there is string class. (If an identifier is used static it is direct instanced to an object in the main stack of a program)

However, a textbox.Text contains a kind of immutable reference type object.

https://msdn.microsoft.com/en-us/library/system.string%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396


这篇关于有没有一种方法可以将字符串转换为类?我能做还是失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆