예제 #1
0
        private void WriteSpecialization(Specialization specialization, DisplayOptions options, XmlWriter writer)
        {
            // write the type itself (without outer types, because those will be written be other calls to this routine)
            WriteSimpleType(specialization.TemplateType, (options & ~DisplayOptions.ShowTemplates), false, writer);

            // then write the template arguments
            WriteTemplateArguments(specialization.Arguments, writer);
        }
예제 #2
0
        private static SpecializedTypeReference CreateSpecializedTypeReference(string api)
        {
            List<Specialization> specializations = new List<Specialization>();

            string text = String.Copy(api);

            // At the moment we are only handling one specialization; need to iterate
            int specializationStart = text.IndexOf('{');
            int specializationEnd = FindMatchingEndBracket(text, specializationStart);
            string list = text.Substring(specializationStart + 1, specializationEnd - specializationStart - 1);
            IList<string> types = SeparateTypes(list);
            string template = text.Substring(0, specializationStart) + String.Format(CultureInfo.InvariantCulture,
                "`{0}", types.Count);

            SimpleTypeReference templateReference = CreateSimpleTypeReference(template);
            TypeReference[] argumentReferences = new TypeReference[types.Count];

            for(int i = 0; i < types.Count; i++)
                argumentReferences[i] = CreateTypeReference(types[i]);

            Specialization specialization = new Specialization(templateReference, argumentReferences);

            specializations.Add(specialization);

            // end iteration

            return new SpecializedTypeReference(specializations);
        }