daily pastebin goal
74%
SHARE
TWEET

Untitled

a guest Apr 20th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace Entities
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     // using System.Diagnostics.Contracts;
  6.    
  7.     public class PersonValueObject {
  8.         private string[] _columns = { "firstname", "lastname" };
  9.         private Hashtable _values;
  10.        
  11.         public PersonValueObject () {
  12.             Console.WriteLine("person value object init");
  13.            
  14.             this._values = new Hashtable();
  15.            
  16.             for (int x = 0; x < _columns.Length; x++) {
  17.                 this[_columns[x]] = "";
  18.             }
  19.         }
  20.        
  21.         public string this[string key] {
  22.             get {
  23.                 // Contract.Requires(key != null);
  24.                 // Contract.Requires(_values.ContainsKey(key));
  25.                
  26.                 return (string) _values[key];
  27.             }
  28.             set {
  29.                 // Contract.Requires(key != null);
  30.                 // Contract.Requires(_values.ContainsKey(key));
  31.                 // Contract.Requires(value != null);
  32.                
  33.                 _values[key] = (string) value;
  34.             }
  35.         }
  36.        
  37.         public void SetValues(Hashtable values) {
  38.             IDictionaryEnumerator enumerator = values.GetEnumerator();
  39.            
  40.             while (enumerator.MoveNext()) {
  41.                 this[(string) enumerator.Key] = (string) enumerator.Value;
  42.             }
  43.         }
  44.        
  45.         public Hashtable GetValues() {
  46.             return _values;
  47.         }
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top