Advertisement
Guest User

Inner struct containing the fields, outer class for the clas

a guest
Aug 6th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1.     // Container of the "real" data
  2.     struct FooInternal
  3.     {
  4.         public int Foo1;
  5.         public int Foo2;
  6.         public List<int> Foos;
  7.     }
  8.  
  9.     class Foo
  10.     {
  11.         private FooInternal FooInternal;
  12.  
  13.         public Foo()
  14.         {
  15.             this.FooInternal.Foos = new List<int>();
  16.         }
  17.  
  18.         public Foo(Foo other)
  19.         {
  20.             // "clone" operation
  21.             this.FooInternal = other.FooInternal;
  22.         }
  23.  
  24.         /* Proxies */
  25.  
  26.         public int Foo1
  27.         {
  28.             get
  29.             {
  30.                 return this.FooInternal.Foo1;
  31.             }
  32.  
  33.             set
  34.             {
  35.                 this.FooInternal.Foo1 = value;
  36.             }
  37.         }
  38.  
  39.         public int Foo2
  40.         {
  41.             get
  42.             {
  43.                 return this.FooInternal.Foo2;
  44.             }
  45.  
  46.             set
  47.             {
  48.                 this.FooInternal.Foo2 = value;
  49.             }
  50.         }
  51.  
  52.         public List<int> Foos
  53.         {
  54.             get
  55.             {
  56.                 return this.FooInternal.Foos;
  57.             }
  58.  
  59.             set
  60.             {
  61.                 this.FooInternal.Foos = value;
  62.             }
  63.         }
  64.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement