Beispiel #1
0
        public ArrayTypeWriter(InitializationContext context)
        {
            Type elementType = context.Type.IsArray ? context.Type.GetElementType() : context.Type.GetGenericArguments() [0];

            ValueTypeWriter = TypeWriterFactory.CreateInstance(new InitializationContext(context, elementType)
            {
                AsMember = false
            });

            Definition = (context.AsMember ? "<a" : "<A")
                         + ValueTypeWriter.Definition
                         + (context.AsMember ? "/a" : "/A");
        }
Beispiel #2
0
        public DictionaryTypeWriter(InitializationContext context)
        {
            KeyTypeWriter = TypeWriterFactory.CreateInstance(new InitializationContext(context, context.Type.GetGenericArguments() [0])
            {
                AsMember = true
            });
            ValueTypeWriter = TypeWriterFactory.CreateInstance(new InitializationContext(context, context.Type.GetGenericArguments()[1])
            {
                AsMember = true
            });

            Definition = (context.AsMember ? "<d" : "<D")
                         + "k" + KeyTypeWriter.Definition
                         + "v" + ValueTypeWriter.Definition
                         + (context.AsMember ? "/d" : "/D");
        }