级联和链接之间的差异是什么? [英] what is the diference between cascading and chaining

查看:76
本文介绍了级联和链接之间的差异是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是从一个关于级联的论坛中找到的。问题是级联在大便中意味着什么。我试图找到谷歌的答案,也试图找到一些其他stackoverflow线程,但我不能。我只是找到这个链接 http://en.wikipedia.org/wiki/Method_cascading

I just find from a forum about cascade. The question was what does cascading means in poo. I tried to find to google the answer, also tried to find some other stackoverflow threads about if but I couldn't. I just find this link http://en.wikipedia.org/wiki/Method_cascading

我知道什么是链接,我使用它,大多数是在javascript,jquery和其他语言中,但我不理解链接和级联之间的区别。有谁能够帮我?或者任何人都可以提供一些有用的链接吗?

I know what is chaining, I used it, most in javascript, jquery and other languages, but I coundn't understand the difference between chaining and cascading. Can anybody help me? Or can anybody provide some useful links regarding to this?

推荐答案

链接是返回要使用的方法调用的结果的地方在下次通话中。

Chaining is where you return the result of the method call to be used in the next call.

c#

Enumerable.Range(0,10).Skip(1).Aggregate(myList.First(),(result,listItem) => result += listItem));
//results in 45 being returned

级联可以通过在<$时使用链接来实现c $ c>返回此(有时难以区分两者)。 jQuery就是这样做的。

Cascading can be implemented by using chaining when this is returned (making it sometimes tricky to differentiate between the two). jQuery does this.

jquery

$("#myId").css("background-color","blue").fadeIn().fadeOut();
//results in $("#myId") being returned

这篇关于级联和链接之间的差异是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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