C#4动态关键字 - 为什么不? [英] C#4 dynamic keyword - why not?

查看:91
本文介绍了C#4动态关键字 - 为什么不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读了许多对的回复这个线程,我看到很多不喜欢的人引用了滥用新关键字的潜力。我的问题是,什么样的虐待?这怎么可能被滥用,以至于使人们强烈不喜欢它?它只是纯粹主义吗?

After reading many of the replies to this thread, I see that many of those who dislike it cite the potential for abuse of the new keyword. My question is, what sort of abuse? How could this be abused so badly as to make people vehemently dislike it? Is it just about purism? Or is there a real pitfall that I'm just not seeing?

推荐答案

有些人认为这是一个会被滥用的工具。像VB中的选项严格关闭和错误恢复下一步,纯语言像C#和Java从来没有。

Some see it as a tool that will be abused. Like "Option Strict Off" and "On Error Resume Next" in VB which "pure" languages like C# and Java have never had.

很多人说关于var关键字,但是我没有看到它被滥用,一旦它被理解为不是VB的变体

Many said the same about the "var" keyword, yet I don't see it being abused, once it became understood that it wasn't the same as VB's "Variant"

它可能会被滥用在那些惰性开发人员不希望对类进行类型检查,只是尝试catch动态调用而不是写if blah is Blah .. 。。

It could be abused in places that lazy developers don't want type checking on classes and just try catch dynamic calls instead of writing "if blah is Blah ...".

我个人觉得它可以在最近的问题,我回答。

I personally feel it could be used properly in situations like this recent question that I answered.

我认为,真正了解它的力量是那些沉重的动态。 NET语言。

I think the ones really understanding it's power are those heavily into the dynamic .NET languages.

这篇关于C#4动态关键字 - 为什么不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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