Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Entities
- {
- using System;
- using System.Collections;
- // using System.Diagnostics.Contracts;
- public class PersonValueObject {
- private string[] _columns = { "firstname", "lastname" };
- private Hashtable _values;
- public PersonValueObject () {
- Console.WriteLine("person value object init");
- this._values = new Hashtable();
- for (int x = 0; x < _columns.Length; x++) {
- this[_columns[x]] = "";
- }
- }
- public string this[string key] {
- get {
- // Contract.Requires(key != null);
- // Contract.Requires(_values.ContainsKey(key));
- return (string) _values[key];
- }
- set {
- // Contract.Requires(key != null);
- // Contract.Requires(_values.ContainsKey(key));
- // Contract.Requires(value != null);
- _values[key] = (string) value;
- }
- }
- public void SetValues(Hashtable values) {
- IDictionaryEnumerator enumerator = values.GetEnumerator();
- while (enumerator.MoveNext()) {
- this[(string) enumerator.Key] = (string) enumerator.Value;
- }
- }
- public Hashtable GetValues() {
- return _values;
- }
- }
- }
Add Comment
Please, Sign In to add comment