protected virtual void WriteThreadSafetySection(int level, DocumentFormatter output, IEnumerable <XmlThreadSafety> threadSafeties) { var threadSafety = threadSafeties?.FirstOrDefault(); if (threadSafety == null) { return; } output.Header(level, "Thread Safety"); if (threadSafety.Static && threadSafety.Instance) { output.Section("Any public member of this type, either static or instance, is thread-safe."); } else if (threadSafety.Static && !threadSafety.Instance) { output.Section("Any public static member of this type is thread-safe, but instance members are not guaranteed to be thread-safe."); } else if (!threadSafety.Static && threadSafety.Instance) { output.Section("Any public static member of this type is not guaranteed to be thread-safe, but instance members are thread-safe."); } else { output.Section("Neither public nor instance members of this type are guaranteed to be thread-safe."); } }
public override void WriteSummary(DocumentFormatter output, OutputContext context) { var summary = context.Document.Of(this)?.Summaries; if (summary != null && summary.Count != 0) { output.Section(() => output.Xml(summary)); } else { output.Section(() => WriteDefaultSummary(output, context)); } }
public virtual void WriteParametersSection(int level, DocumentFormatter output, OutputContext context, IEnumerable <ParameterInfo> parameters) { if (parameters == null || !parameters.Any()) { return; } var doc = context.Document.Of(this); output.Header(level, "Parameters"); output.DefinitionList(parameters, parameter => { output.Text(parameter.Name, TextStyles.Teletype); output.Text(": "); if (parameter.ParameterType.IsGenericParameter) { output.Text(parameter.ParameterType.GetDisplayName(), TextStyles.Emphasize); } else { output.LinkCRef(parameter.ParameterType.GetCRef(), parameter.ParameterType.GetDisplayName()); } }, parameter => output.Section(() => doc?.Parameters.For(parameter.Name, output.Xml, name => Log.WarnMisisngParameterDoc(this, name)))); }
protected virtual void WriteOverloadsSummary(DocumentFormatter output, OutputContext context) { var doc = Overloads.Select(o => context.Document.Of(o)?.Overloads.FirstOrDefault()).FirstOrDefault(o => o != null); if (doc != null) { if (doc.Summaries.Any()) { output.Xml(doc.Summaries); } else { output.Section(() => output.Xml(doc)); } } }
public virtual void WriteTypeParametersSection(int level, DocumentFormatter output, OutputContext context, IEnumerable <Type> typeParameters) { if (typeParameters == null || !typeParameters.Any()) { return; } var doc = context.Document.Of(this); output.Header(level, "Type Parameters"); output.DefinitionList(typeParameters, typeParameter => output.Text(typeParameter.Name, TextStyles.Teletype), typeParameter => output.Section(() => { if (WriteTypeParamDoc(doc, typeParameter.Name)) { return; } if (!typeParameter.IsGenericMethodParameter) { for (var parent = Owner; parent != null; parent = parent.Owner) { if (WriteTypeParamDoc(context.Document.Of(parent), typeParameter.Name)) { return; } } } Log.WarnMisisngTypeParameterDoc(this, typeParameter.Name); })); bool WriteTypeParamDoc(XmlMember ownerDoc, string paramName) { if (ownerDoc != null && ownerDoc.TypeParameters.TryGetValue(paramName, out var paramDoc)) { output.Xml(paramDoc); return(true); } return(false); } }
public override void WriteSummaryLine(DocumentFormatter output, OutputContext context) { output.Section("The ", (Name, TextStyles.Teletype), " namespace exposes the following types."); }