Exemplo n.º 1
0
        public void Write(TextWriter writer, Type type)
        {
            WriteTypeKind(writer, type);
            writer.Write(" \"");

            _typeNameWriter.Write(writer, type);
            writer.Write("\" as ");
            _escapedTypeNameWriter.Write(writer, type);

            writer.WriteLine(" {");

            WriteMembers(
                writer,
                () => _queryType.GetFields(type),
                i => _fieldWriter.Write(writer, i));

            WriteMembers(
                writer,
                () => _queryType.GetProperties(type),
                i => _propertyWriter.Write(writer, i));

            WriteMembers(
                writer,
                () => _queryType.GetMethods(type),
                i => _methodWriter.Write(writer, i));

            WriteMembers(
                writer,
                () => _queryType.GetEvents(type),
                i => _eventWriter.Write(writer, i));

            writer.WriteLine("}");
        }
Exemplo n.º 2
0
        public void Write(TextWriter writer, Type type, IQueryType queryType)
        {
            WriteTypeKind(writer, type);
            writer.Write(' ');
            _typeNameWriter.Write(writer, type);

            if (type.BaseType != null)
            {
                writer.Write(" : ");
                _typeNameWriter.Write(writer, type.BaseType);
            }

            var implementedInterfaces = queryType.GetInterfaces(type).ToArray();

            if (implementedInterfaces.Length > 0)
            {
                writer.Write(" implements ");
                writer.Write(string.Join(',', implementedInterfaces.Select(_typeNameConverter.ToString)));
            }

            writer.WriteLine(" {");

            WriteMembers("Fields",
                         writer,
                         () => queryType.GetFields(type),
                         i => _fieldWriter.Write(writer, i));

            WriteMembers("Properties",
                         writer,
                         () => queryType.GetProperties(type),
                         i => _propertyWriter.Write(writer, i));

            WriteMembers("Methods",
                         writer,
                         () => queryType.GetMethods(type),
                         i => _methodWriter.Write(writer, i));

            WriteMembers("Events",
                         writer,
                         () => queryType.GetEvents(type),
                         i => _eventWriter.Write(writer, i));

            writer.WriteLine("}");
        }