public override void Request() { if (realSubject == null) { LoadRealSubject(); } realSubject.Request(); }
public override void Request() { //throw new NotImplementedException(); if (proxy == null) { proxy = new RealSubject(); } proxy.Request(); }
public string Request() { if (_subject == null) { return("Protection Proxy: Authenticate first"); } return("Protection Proxy: Call to " + _subject.Request()); }
public override void Request() { /*Use 'lazy initialization'*/ if (_realSubject == null) { _realSubject = new Subject(); } _realSubject.Request(); }
public string Request() { if (subject == null) { Console.WriteLine("Subject inactive"); subject = new Subject(); } Console.WriteLine("Subject active"); return("Proxy: Call to " + subject.Request()); }
public string Request() { //a virtual proxy creates the object only on its first method call if (_subject == null) { Console.WriteLine("Subject inactive"); _subject = new Subject(); } Console.WriteLine("Subject active"); return("Proxy: Call to " + _subject.Request()); }
public void Request() { Console.WriteLine($"This method is being called on : {this.ToString()}"); //create a lazy loader for the Subject if (_subject == null) { _subject = new Subject(); } Console.WriteLine(" |"); Console.Write(" ---"); _subject.Request(); }
public void Request() { var counter = 0; while (true) { Console.WriteLine("Enter your password:"******"ivan", StringComparison.CurrentCultureIgnoreCase)) { _subject.Request(); break; } else { Console.WriteLine("No Subject for you :("); } counter++; if (counter == 3) { break; } } }
public static void UseSubject(Subject subject) { subject.Request(); }