using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiversDemos {
	public class EtendableInsensibleALaCasse : System.Dynamic.DynamicObject {
		public Dictionary<string, object> DicoDObjets;
		public EtendableInsensibleALaCasse() {
			DicoDObjets = new Dictionary<string, object>();
		}
		public override bool TryGetMember( GetMemberBinder binder, out object resultat ) {
			object valeur;
			if( DicoDObjets.TryGetValue( binder.Name.ToLower(), out valeur ) ) {
				resultat = valeur;
				return true;
			}
			resultat = null;
			return false;
		}
		public override bool TrySetMember( SetMemberBinder binder, object valeur ) {
			DicoDObjets[binder.Name.ToLower()] = valeur;
			return true;
		}
	}

}
