Advertisement
Tician

C# Return Value for Classes

Jan 18th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.     class A
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.  
  6.             C c = new C();
  7.             B b = c.DoSomething("hello.txt");
  8.         }
  9.     }
  10.  
  11.  
  12.  
  13.  
  14.     class B
  15.     {
  16.         public string text;
  17.         public string source { get; set; }
  18.         public string destination { get; set; }
  19.     }
  20.  
  21.  
  22.  
  23.  
  24.     class C
  25.     {
  26.         string filename;
  27.         string text;
  28.  
  29.         public Settings DoSomething(string filename)
  30.         {
  31.             this.filename = filename
  32.             //DoSomething
  33.             return new Settings
  34.             {
  35.                 source = Convert.ToString(1),
  36.                 destination = Convert.ToString(2),
  37.                 text = text
  38.             };
  39.         }
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement