当前位置: 首页 > wzjs >正文

淘宝做推广网站建立网站需要技术吗

淘宝做推广网站,建立网站需要技术吗,公众号编辑,wordpress只能写博客吗85. What are anonymous types? 匿名类型是在需要的地方直接定义的类型,甚至都 不给它命名。它非常适合我们这种用例——类型小且临时,而且我们无意在其 他地方使用它 匿名类型是直接从 System.Object 派生的类对象。它们不能转换为任何 其他类型。●…
85. What are anonymous types?

匿名类型是在需要的地方直接定义的类型,甚至都 不给它命名。它非常适合我们这种用例——类型小且临时,而且我们无意在其 他地方使用它

  1. 匿名类型是直接从 System.Object 派生的类对象。它们不能转换为任何 其他类型。
  2. ● 它们重写了 `Equals` 和 `GetHashCode` 方法以支持基于值的相等性。具 有相同值的两个匿名对象将具有相同的哈希码,并且 `Equals` 方法将 返回 `true`。请注意,`==` 运算符未被重载,因此它将返回 `false` (因为它们的引用不同)。
  3. ● 它们支持使用“with”关键字进行非破坏性修改。记住:非破坏性修 改不是改变原始对象,而是创建一个具有修改后值的新对象。

Can we modify the value of an anonymous type property? 否。所有匿名类 型的属性都是只读的

When should we, and should we not use anonymous types? 匿名类型的最佳使用场景是当我们想要使用的类型简单且仅限于某个 特定上下文,并且不会在其他地方使用时。它通常在复杂的 LINQ 查询 中用作临时对象。如果类型复杂或者我们想要重复使用它,就不应该使 用匿名类型。此外,匿名类型只能提供只读属性;它们不能有方法、字段、 事件等,所以如果需要这些功能,匿名类型就不适用了

Are anonymous types value or reference types? 它们是引用类型,因为它们是类,但它们通过 `Equals` 方法支持基于值的 相等性比较。换句话说,即使两个匿名对象的引用不同,只要它们的属性值 相同,`Equals` 方法也会认为它们相等

92. What is the Observer design pattern?
var bitcoinPriceReader = new BitcoinPriceReader();var emailPriceChangeNotifier = new EmailPriceChangeNotifier(25000);
bitcoinPriceReader.AttachObserver(emailPriceChangeNotifier);var pushPriceChangeNotifier = new PushPriceChangeNotifier(40000);
bitcoinPriceReader.AttachObserver(pushPriceChangeNotifier);bitcoinPriceReader.ReadCurrentPrice();
bitcoinPriceReader.ReadCurrentPrice();Console.WriteLine("Push notifications OFF");
bitcoinPriceReader.DetachObserver(pushPriceChangeNotifier);bitcoinPriceReader.ReadCurrentPrice();Console.ReadKey();//首先,让我们定义 IObserver 接口,该接口将由电子邮件价格变化通知器和推送价格变化通知器实现。
public interface IObserver<TData>
{void Update(TData data);
}public interface IObservable<TData>
{void AttachObserver(IObserver<TData> observer);void DetachObserver(IObserver<TData> observer);void NotifyObservers();
}//可观察对象:读取价格
public class BitcoinPriceReader : IObservable<decimal>
{private decimal _currentBitcoinPrice;//。首先,我们需要定义一个观察者集合:private List<IObserver<decimal>> _observers = new List<IObserver<decimal>>();public void AttachObserver(IObserver<decimal> observer){_observers.Add(observer);}public void DetachObserver(IObserver<decimal> observer){_observers.Remove(observer);}//NotifyObservers 方法将简单地遍历观察者列表,并使用 _currentBitcoinPrice对其执行 Update 方法:public void NotifyObservers(){foreach (var observer in _observers){observer.Update(_currentBitcoinPrice);}}public void ReadCurrentPrice(){_currentBitcoinPrice = new Random().Next(0, 50000);NotifyObservers();}
}//观察者:等待接收价格变动通知的类
public class EmailPriceChangeNotifier : IObserver<decimal>
{private readonly decimal _notificationThreshold;public EmailPriceChangeNotifier(decimal notificationThreshold){_notificationThreshold = notificationThreshold;}public void Update(decimal currentBitcoinPrice){if (currentBitcoinPrice > _notificationThreshold){Console.WriteLine($"Sending an email saying that " +$"the Bitcoin price exceeded {_notificationThreshold} " +$"and is now {currentBitcoinPrice}\n");}}
}public class PushPriceChangeNotifier : IObserver<decimal>
{private readonly decimal _notificationThreshold;public PushPriceChangeNotifier(decimal notificationThreshold){_notificationThreshold = notificationThreshold;}public void Update(decimal currentBitcoinPrice){if (currentBitcoinPrice > _notificationThreshold){Console.WriteLine($"Sending a push notification saying that " +$"the Bitcoin price exceeded {_notificationThreshold} " +$"and is now {currentBitcoinPrice}\n");}}
}

In the Observer design pattern, what is the Observable and what is the Observer? 可观察对象是被观察者所观察的对象。可观察对象会将自身状态的变化 通知给观察者


文章转载自:

http://ib8YEyac.bLfgh.cn
http://HO5cHrb0.bLfgh.cn
http://kE1lGGVC.bLfgh.cn
http://qK1uj3d0.bLfgh.cn
http://ZVNEFoAA.bLfgh.cn
http://V0xTiGVq.bLfgh.cn
http://aOcXANbC.bLfgh.cn
http://AXEjHo1S.bLfgh.cn
http://R6SyHtYI.bLfgh.cn
http://NI761BJv.bLfgh.cn
http://K3Ysc9UR.bLfgh.cn
http://fo05FtGP.bLfgh.cn
http://xEhVQTXO.bLfgh.cn
http://FC8FgCBa.bLfgh.cn
http://hIiZmsEM.bLfgh.cn
http://OO2T6Sgu.bLfgh.cn
http://u3XsO2kX.bLfgh.cn
http://u5sSelIP.bLfgh.cn
http://4no2yqvW.bLfgh.cn
http://c7VdsY8J.bLfgh.cn
http://789S7vxE.bLfgh.cn
http://96DMmVHg.bLfgh.cn
http://RXMemfdq.bLfgh.cn
http://VFaiBBXm.bLfgh.cn
http://eDr1wRXd.bLfgh.cn
http://lWUf5SiP.bLfgh.cn
http://wf2qRC9E.bLfgh.cn
http://r70Qw92L.bLfgh.cn
http://S8hf2EXi.bLfgh.cn
http://8ic5LxQx.bLfgh.cn
http://www.dtcms.com/wzjs/709555.html

相关文章:

  • 简洁公司网站源码对招聘公司做评价的网站
  • seo视频网页入口网站推广wordpress特效插件
  • 广州网站推广联盟wordpress根据用户显示文章
  • 怎样建立网站邢台建设银行网站
  • 单页网站 seo黄州做网站的
  • 网站里面内外链接如何做做聚美优品网站得多少钱
  • 网站建设拓扑图苏州app定制
  • 网站搭建设计 是什么意思海口网红图书馆
  • 织梦网站搬迁个人怎么做网站
  • 挣钱网站一小时两百做博客网站要什么技术
  • 网站开发语言作用python 创建wordpress
  • wordpress详细安装教程广东seo课程
  • 常德做网站建设的公司学习网站建设的步骤
  • 福州网页建站维护有哪些怎么自己设计logo
  • 网站建设招标提问域名安装wordpress
  • 建网站找兴田德润天津 公司网站建设
  • 什么是网络营销产生的现实原因天津seo公司网站
  • 客户网站建设确认书建湖做网站需要多少钱
  • 做最好的在线中文绅士本子阅读网站如何用 ftp上传网站
  • 不用域名访问网站网站内链怎么优化
  • 网站建设语言环境深圳专业画册设计机构
  • 网站建设的合同 体会大连零基础网站建设培训电话
  • 网站购物建设实训心得体会a做片手机免费网站有哪些
  • 长治网站设计制作网站用visual做的网站
  • html5手机网站教程wordpress登陆ip唯一
  • 合肥网站 技术支持 上诚科技打代码怎么做网站
  • 交通运输网站建设的方案网站建设的要素
  • 青浦手机网站制作有哪些做分析图用的地图网站
  • 宁波有没有开发网站的公司友情链接交换网址大全
  • 中国万网怎么自己做网站采集侠 wordpress