Exemplo n.º 1
0
        public void DynamicDictionary()
        {
            var dic = new StringKeyDictionaryDynamic
            {
                { "int", 1 },
                { "bool", true },
                { "date", DateTime.Now },
                { "null", null }
            };

            dic.GetItem("int");
            dic.Get <bool>("bool");
            dic.Get <DateTime>("int");
        }
Exemplo n.º 2
0
        public void DynamicObjectDictionary()
        {
            object intObj  = 1;
            object boolObj = true;
            object dateObj = DateTime.Now;
            object?nullObj = null;

            var dic = new StringKeyDictionaryDynamic
            {
                { "int", intObj },
                { "bool", boolObj },
                { "date", dateObj },
                { "null", nullObj }
            };

            dic.GetItem("int");
            dic.Get <bool>("bool");
            dic.Get <DateTime>("int");
        }