当一个人应该用动态的关键字在C#4.0? [英] When should one use dynamic keyword in c# 4.0?

查看:102
本文介绍了当一个人应该用动态的关键字在C#4.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当一个人应该使用动态关键字在C#4.0?.......在C#4.0的动态关键字的任何很好的例子,说明它的使用....

When should one use dynamic keyword in c# 4.0?.......Any good example with dynamic keyword in c# 4.0 that explains its usage....

推荐答案

动态只应使用的不使用它是痛苦的时候。像微软Office库。在所有其他情况下,应避免编译类型检查是有益的。下面是使用动态的良好局面。

Dynamic should be used only when not using it is painful. Like in MS Office libraries. In all other cases it should be avoided as compile type checking is beneficial. Following are the good situation of using dynamic.


  1. 调用Silverlight的JavaScript方法。

  2. COM互操作。

  3. 也许读XML,JSON,而无需创建自定义类。

这篇关于当一个人应该用动态的关键字在C#4.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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