public override void WriteDocumentation(DocumentationWriter writer) { writer.WriteHeader(); writer.WritePageTitle(Name, "Namespace"); writer.Write(this, Documentation.GetSummary()); writer.Write("### Remarks", Documentation.GetRemarks(), this); if (writer.NestedTypeVisibility == NestedTypeVisibility.Namespace || writer.NestedTypeVisibility == NestedTypeVisibility.Everywhere) { writer.WriteChildrenLink <ClassDocItem>("Classes"); writer.WriteChildrenLink <StructDocItem>("Structs"); writer.WriteChildrenLink <InterfaceDocItem>("Interfaces"); writer.WriteChildrenLink <EnumDocItem>("Enums"); writer.WriteChildrenLink <DelegateDocItem>("Delegates"); } else { writer.WriteDirectChildrenLink <ClassDocItem>("Classes"); writer.WriteDirectChildrenLink <StructDocItem>("Structs"); writer.WriteDirectChildrenLink <InterfaceDocItem>("Interfaces"); writer.WriteDirectChildrenLink <EnumDocItem>("Enums"); writer.WriteDirectChildrenLink <DelegateDocItem>("Delegates"); } }
public override void WriteDocumentation(DocumentationWriter writer) { writer.WriteHeader(); writer.WritePageTitle(Name, Type.Kind.ToString()); writer.Write(this, Documentation.GetSummary()); List <IType> interfaces = Type.DirectBaseTypes.Where(t => t.Kind == TypeKind.Interface && t.GetDefinition().Accessibility == Accessibility.Public).ToList(); writer.WriteLine("```csharp"); writer.Write(CodeAmbience.ConvertSymbol(Type)); IType baseType = Type.DirectBaseTypes.FirstOrDefault(t => t.Kind == TypeKind.Class && !t.IsKnownType(KnownTypeCode.Object) && !t.IsKnownType(KnownTypeCode.ValueType)); if (baseType != null) { writer.Write(" : "); writer.Write(BaseTypeAmbience.ConvertType(baseType)); } foreach (IType @interface in interfaces) { writer.WriteLine(baseType is null ? " :" : ","); baseType = Type; writer.Write(BaseTypeAmbience.ConvertType(@interface)); } writer.Break(); writer.WriteLine("```"); if (Type.Kind == TypeKind.Class) { writer.Write("Inheritance "); writer.Write(string.Join(" > ", Type.GetNonInterfaceBaseTypes().Select(t => writer.GetTypeLink(this, t)))); writer.WriteLine(" "); if (interfaces.Count > 0) { writer.Break(); } } // attribute if (interfaces.Count > 0) { writer.Write("Implements "); writer.Write(string.Join(", ", interfaces.Select(t => writer.GetTypeLink(this, t)))); writer.WriteLine(" "); } writer.WriteDocItems(TypeParameters, "#### Type parameters"); writer.Write("### Example", Documentation.GetExample(), this); writer.Write("### Remarks", Documentation.GetRemarks(), this); writer.WriteDirectChildrenLink <ConstructorDocItem>("Constructors"); writer.WriteDirectChildrenLink <FieldDocItem>("Fields"); writer.WriteDirectChildrenLink <PropertyDocItem>("Properties"); writer.WriteDirectChildrenLink <MethodDocItem>("Methods"); writer.WriteDirectChildrenLink <EventDocItem>("Events"); writer.WriteDirectChildrenLink <OperatorDocItem>("Operators"); }
public override void WriteDocumentation(DocumentationWriter writer) { writer.WriteHeader(); writer.WritePageTitle(Name, Type.Kind.ToString()); writer.Write(this, Documentation.GetSummary()); List <IType> interfaces = Type.DirectBaseTypes.Where(t => t.Kind == TypeKind.Interface && t.GetDefinition().Accessibility == Accessibility.Public).ToList(); writer.WriteLine("```csharp"); writer.Write(CodeAmbience.ConvertSymbol(Type)); IType baseType = Type.DirectBaseTypes.FirstOrDefault(t => t.Kind == TypeKind.Class && !t.IsKnownType(KnownTypeCode.Object) && !t.IsKnownType(KnownTypeCode.ValueType)); if (baseType != null) { writer.Write(" : "); writer.Write(BaseTypeAmbience.ConvertType(baseType)); } foreach (IType @interface in interfaces) { writer.WriteLine(baseType is null ? " :" : ","); baseType = Type; writer.Write(BaseTypeAmbience.ConvertType(@interface)); } writer.Break(); writer.WriteLine("```"); bool needBreak = false; if (Type.Kind == TypeKind.Class) { writer.Write("Inheritance "); writer.Write(string.Join(" 🡒 ", Type.GetNonInterfaceBaseTypes().Where(t => t != Type).Select(writer.GetTypeLink))); writer.Write(" 🡒 "); writer.Write(Name); writer.WriteLine(" "); needBreak = true; } List <TypeDocItem> derived = writer.KnownItems.OfType <TypeDocItem>().Where(i => i.Type.DirectBaseTypes.Select(t => t is ParameterizedType g ? g.GetDefinition() : t).Contains(Type)).OrderBy(i => i.FullName).ToList(); if (derived.Count > 0) { if (needBreak) { writer.Break(); } writer.Write("Derived " + Environment.NewLine + "↳ "); writer.Write(string.Join(" " + Environment.NewLine + "↳ ", derived.Select(t => writer.GetLink(t)))); writer.WriteLine(" "); needBreak = true; } // attribute if (interfaces.Count > 0) { if (needBreak) { writer.Break(); } writer.Write("Implements "); writer.Write(string.Join(", ", interfaces.Select(writer.GetTypeLink))); writer.WriteLine(" "); } writer.WriteDocItems(TypeParameters, "#### Type parameters"); writer.Write("### Example", Documentation.GetExample(), this); writer.Write("### Remarks", Documentation.GetRemarks(), this); writer.WriteDirectChildrenLink <ConstructorDocItem>("Constructors"); writer.WriteDirectChildrenLink <FieldDocItem>("Fields"); writer.WriteDirectChildrenLink <PropertyDocItem>("Properties"); writer.WriteDirectChildrenLink <MethodDocItem>("Methods"); writer.WriteDirectChildrenLink <EventDocItem>("Events"); writer.WriteDirectChildrenLink <OperatorDocItem>("Operators"); if (writer.NestedTypeVisibility == NestedTypeVisibility.DeclaringType || writer.NestedTypeVisibility == NestedTypeVisibility.Everywhere) { writer.WriteDirectChildrenLink <ClassDocItem>("Classes"); writer.WriteDirectChildrenLink <StructDocItem>("Structs"); writer.WriteDirectChildrenLink <InterfaceDocItem>("Interfaces"); writer.WriteDirectChildrenLink <EnumDocItem>("Enums"); writer.WriteDirectChildrenLink <DelegateDocItem>("Delegates"); } }