如何创建C#4动态类? [英] How do create a Dynamic class in C# 4?

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

问题描述

我要建立在C#中的对象,有它的基础上,获取不存在的方法的名称做一些有趣的事情。

I want to create an object in C# and have it do interesting things based on the name of the non-existent method that gets.

在红宝石,这是method_missing的。在Perl中,这是自动加载。

In ruby, this is method_missing. In Perl, this is AUTOLOAD.

我似乎无法找到进入System.Dynamic在C#。

I can't seem to find the way into System.Dynamic in C#.

推荐答案

尝试使用的 System.Dynamic.DynamicObject 的一个简单的出发点和基类。您可以在 http://winterdom.com/2009/05/dynamicobject-in-c-一个例子40

Try using System.Dynamic.DynamicObject as a simple starting point and base class. You can find an example at http://winterdom.com/2009/05/dynamicobject-in-c-40.

这篇关于如何创建C#4动态类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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