动态创建一个类及其方法 [英] create a class and its method dynamically

查看:80
本文介绍了动态创建一个类及其方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关于动态创建一个类和方法,

考虑我有两个文本框,一个是敌人的类名,另一个是它的方法名,



如果我键入CAR和SPEED



类和方法应该在文件中创建如下



this is about creating a class and methods dynamically,,
consider am having two textboxes, one is foe classname and another is for its method name,

if i type "CAR" and "SPEED"

the class and method should be created as follows in a file

class CAR
{
  public void SPEED()
  {

  }
}





是否有可能?帮我



Is tat is possible?? help me

推荐答案

看看:

动态加载类并在.NET中执行方法 [ ^ ]

动态调用方法,给定方法名称和类的字符串名称 [ ^ ]



类似讨论:

在运行时动态创建C#.net中的类 [ ^ ]
Have a look:
Dynamically load a class and execute a method in .NET[^]
Dynamically Invoke A Method, Given Strings with Method Name and Class Name[^]

Similar discussion:
Create Class in C#.net Dynamically in Runtime[^]


这篇关于动态创建一个类及其方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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