Guest User

Untitled

a guest
Jan 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. namespace We.Enterprise.Now
  2. {
  3.     class HelloWorld
  4.     {
  5.         private string _helloString;
  6.         public string HelloString
  7.         {
  8.             get
  9.             {
  10.                 return _helloString;
  11.             }
  12.             set
  13.             {
  14.                 _helloString = value;
  15.             }
  16.         }
  17.  
  18.         public HelloWorld(string helloString)
  19.         {
  20.             this.HelloString = helloString;
  21.         }
  22.  
  23.         public void SayHello()
  24.         {
  25.             System.Console.WriteLine(_helloString);
  26.         }
  27.  
  28.     }
  29.  
  30.     class HelloWorldFactory
  31.     {
  32.         private HelloWorld _helloWorld;
  33.         public HelloWorld HelloWorldObject
  34.         {
  35.             get
  36.             {
  37.                 return _helloWorld;
  38.             }
  39.         }
  40.  
  41.         public HelloWorldFactory(string factoryString)
  42.         {
  43.             _helloWorld = new HelloWorld(factoryString);
  44.         }
  45.     }
  46.  
  47.     class MainClass
  48.     {
  49.         static void Main(string[] args)
  50.         {
  51.             HelloWorldFactory helloWorldFactory;
  52.             if (args.Length > 1)
  53.             {
  54.                 helloWorldFactory = new HelloWorldFactory(args[1]);
  55.             }
  56.             else
  57.             {
  58.                 helloWorldFactory = new HelloWorldFactory("Hello World, We Enterprise Now.");
  59.             }
  60.  
  61.             helloWorldFactory.HelloWorldObject.SayHello();
  62.         }
  63.     }
  64. }
Add Comment
Please, Sign In to add comment