36 Console.WriteLine(
"Proxy Exercise");
38 Console.WriteLine(
" Getting proxy object...");
41 Console.WriteLine(
" Calling Dowork() on proxy...");
42 string output = proxyObject.
DoWork(
"Initial call");
43 Console.WriteLine(
" Output from proxy = \"{0}\"", output);
45 Console.WriteLine(
" Calling Dowork() on proxy...");
46 output = proxyObject.
DoWork(
"Second call");
47 Console.WriteLine(
" Output from proxy = \"{0}\"", output);
49 Console.WriteLine(
" Calling Dowork() on proxy...");
50 output = proxyObject.
DoWork(
"Third call");
51 Console.WriteLine(
" Output from proxy = \"{0}\"", output);
52 Console.WriteLine(
" Done.");
For the purposes of this example, this class encapsulates the real class and proxy class to hide them...
static IWorkByProxy CreateProxy()
Retrieve a new instance of the proxy class.
Example of using the Proxy Pattern in C#.
void Run()
Executes the example for the Proxy Pattern in C#.
Represents what can be done on the proxy object. This same interface is implemented on the real objec...
string DoWork(string someArgument)
Does some work on the given argument and returns a new string.
The namespace containing all Design Pattern Examples implemented in C#.