本文介绍了在运行时动态添加Class属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 有没有办法在运行时添加类属性? 如果是这样,怎么样? 任何代码示例? ***通过开发人员指南 http: //www.developersdex.com *** 解决方案 对于所有意图和目的,不,你不能 - 但是,由于大多数原因,我可以 想到你想要这样做,我可以想到其他编码模式来实现同样的事情。你想要完成什么? 另外,如果你确实需要生成代码,但生成 生成的代码没有在正在生成的项目中,可以使用自动化来完成。我有理由做这样的事情 并且已经成功完成了。is there a way to add a class property an run-time?If so, how?any code samples?*** Sent via Developersdex http://www.developersdex.com *** 解决方案For all intents and purposes, no you can''t - however, for most reasons I canthink of that you''d want to do that, I can think of other coding patterns toaccomplish the same thing. What are you trying to accomplish?Also, if you really do need to generate code, but the code that does thegenerating doesn''t have to be in the project that''s being generated, that cancertainly be done using automation. I''ve had reason to do things like thatand have done it successfully. 这篇关于在运行时动态添加Class属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 12:34