コード例 #1
0
        public void CanConvertPlainDictionary()
        {
            var dictionary = new ADictionary();

            dictionary.Add("First", new bool[] { true });
            dictionary.Add("Second", new bool[] { true, false });
            dictionary.Add("Third", new bool[] { false, false });
            var str = _serializer.Serialize(dictionary);

            Console.WriteLine(dictionary.GetType());
            var inters = dictionary.GetType().GetInterfaces();

            Console.WriteLine((typeof(IDictionary).IsAssignableFrom(dictionary.GetType())));

            foreach (var type in inters)
            {
                if (type.IsGenericType)
                {
                    Console.WriteLine(type.GetGenericTypeDefinition());
                    Console.WriteLine((typeof(IDictionary <,>)) == type.GetGenericTypeDefinition());
                }
            }

            var deserialized = _deserializer.Deserialize <ADictionary>(str);

            Assert.AreEqual(dictionary, deserialized);
        }
コード例 #2
0
 protected virtual Node_Dictionary parseDictionary(ADictionary node)
 {
     return new Node_Dictionary(
     parseOne<PExpression,INode_Expression>(parseExpression, (PExpression)node.GetKeytype()),
     parseOne<PExpression,INode_Expression>(parseExpression, (PExpression)node.GetValuetype()),
     parseMult0<ADictionaryentry,Node_DictionaryEntry>(parseDictionaryEntry, node.GetDictionaryentry()),
     getSource(node));
 }
コード例 #3
0
 private ADictionary(ADictionary other)
     : base(other)
 {
     Contract.Requires(other != null);
 }