public Research(IRelationshipBrowser relationshipBrowser) { foreach (var p in relationshipBrowser.FindAllChildrenOf("John")) { Console.WriteLine("John has a child called : {0}", p.Name); } }
public DRunner(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("John")) { Console.WriteLine($"John has a child named {p.Name}"); } }
//public Program(Relationships relationships) //{ // var relations = relationships.Relations; // foreach (var r in relations.Where(x => x.Item1.Name == "John" && x.Item2 == Relationship.Parent)) // { // Console.WriteLine($"John has a child called {r.Item3.Name}"); // } //} public Program(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("John")) { Console.WriteLine($"John has a child called {p.Name}"); } }
public Research(IRelationshipBrowser relBrowser) { foreach (var child in relBrowser.FindAllChildrenOf("John")) { Console.WriteLine($"John has child called {child.Name}"); } }
public static void SearchAfter(PersonAfter parent, IRelationshipBrowser browser) { foreach (var r in browser.FindALlChildrenOf(parent.Name)) { Console.WriteLine($"{parent.Name} has a child called {r.Name}"); } }
public SingleResponsibility(IRelationshipBrowser browser) { foreach (var r in browser.FindAllChindrenOf("John")) { Console.WriteLine($"John has a child called {r.Name}"); } }
//public Research(Relationships relationships) //{ // var relations = relationships.Relations; // foreach (var r in relations.Where(x => x.Item1.Name == "John" && x.Item2 == Relationship.Parent)) // { // WriteLine($"John has a child called {r.Item3.Name}"); // } //} public Research(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("John")) { WriteLine($"John has a child called {p.Name}"); } }
//public Research(Relationships relationships) //{ // var relations = relationships.Relations; // foreach (var item in relations.Where(x => x.Item1.Name == "Gela" && x.Item2 == Relationship.Parent)) // Console.WriteLine($"Gelas yavs shvili {item.Item3.Name}"); //} public Research(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("Gela")) { Console.WriteLine($"gelas shvilebi: {p.Name}"); } }
public Research(IRelationshipBrowser browser) { foreach (Person child in browser.FindAllChildOf("John")) { Console.WriteLine($"John has a child called {child.Name}"); } }
public Program(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("john")) { //get relationship here } }
public IEnumerable <Person> DoResearch(IRelationshipBrowser browser) { foreach (var p in browser.FindAllChildrenOf("John")) { yield return(p); } }
public BetterResearch(IRelationshipBrowser browser) // access to low level through abstraction { foreach (var r in browser.FindAllChildrenOf("John")) { Console.WriteLine($"John has a child called: {r.Name}"); } }
public Research(IRelationshipBrowser browser, string name) { foreach (var p in browser.FindAllChildrenOf(name)) { Debug.Log(string.Format("{0} has a child call {1}", name, p.Name)); } }
// now what if we want to change some code in relationships class(low level class). // Then we might need to do some change in high level class (Program) // this is violating DependencyInversion // we will create an interface so that high level module will depend on abstraction not concretions //public Program(Relationships relationships) //{ // var relations = relationships.Relations; // foreach (var item in relations.Where(x=>x.Item1.Name == "Rajesh" && x.Item2 == Relationship.Parent)) // { // Console.WriteLine($"Rajesh has a child {item.Item3.Name}"); // } //} public Program(IRelationshipBrowser browser) { var relations = browser.FindAllChildrenOf("Rajesh"); foreach (var item in relations) { Console.WriteLine($"Rajesh has a child {item.Name}"); } }
public Research(IRelationshipBrowser browser) { var parent = "John"; foreach (var person in browser.FindAllChildrenOf(parent)) { Console.WriteLine($"{parent} has a child called {person.Name}"); } }
public Research(IRelationshipBrowser browser) { var children = browser.FindAllChildren("John"); foreach (var child in children) { Console.WriteLine($"John has a child called {child.Name}."); } }
//stari //public Program(Relationships relationships) //{ // //ovo radi sada ali ako izmijenimo Relationships klasu prestaće da radi // var relations = relationships.Relations; // foreach (var r in relations.Where(x => x.Item1.Name == "Dick" && x.Item2 == Relationship.Parent)) // { // Console.WriteLine("Dick has a child called " + r.Item3.Name); // } // foreach (var r in relations.Where(x => x.Item1.Name == "Dick" && x.Item2 == Relationship.Sibling)) // { // Console.WriteLine("Dick has a sibling called " + r.Item3.Name); // } //} //novi public Program(IRelationshipBrowser relationships, List <Person> people) { foreach (var person in people) { foreach (var ch in relationships.FindAllChildrenOf(person)) { Console.WriteLine(person.Name + " has a child called " + ch.Name); } foreach (var ch in relationships.FindAllSiblingsOf(person)) { Console.WriteLine(person.Name + " has a sibling called " + ch.Name); } } }