Add observer pattern

Update memento pattern examples class to have run as static method
Update behavioral patterns program.cs to maintain the order
This commit is contained in:
Petrutiu Mihai
2016-06-23 21:39:13 +03:00
parent 2894347140
commit c66816b938
11 changed files with 224 additions and 19 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ObserverPattern.Twits
{
public class ObservableTwitsExample
{
public void Run()
{
TwitObservable observable = new TwitObservable();
TwitUser t100 = new TwitUser("t100");
TwitUser r2d2 = new TwitUser("r2d2");
var t100Subscription = observable.Subscribe(t100);
var r2d2Subscription = observable.Subscribe(r2d2);
observable.AddTwit("El chupacapra");
t100Subscription.Dispose();
observable.AddTwit("Vamos vamos mi amor");
observable.ItsGoingHomeTime();
}
}
}