本文整理汇总了C#中XDoc.StartSection方法的典型用法代码示例。如果您正苦于以下问题:C# XDoc.StartSection方法的具体用法?C# XDoc.StartSection怎么用?C# XDoc.StartSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDoc
的用法示例。
在下文中一共展示了XDoc.StartSection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMemberTables
private void AddMemberTables(XDoc html, ReflectedTypeInfo type) {
if(!type.Constructors.Any() && !type.Fields.Any() && !type.Properties.Any() && !type.Methods.Any() && !type.Events.Any()) {
return;
}
html.StartSection(1, "members", "Members");
if(type.Constructors.Any()) {
html.StartSection(2, "ctors", "Constructors")
.Start("table")
.Start("tr").Elem("th", "Visibility").Elem("th", "Description").End();
foreach(var member in type.Constructors.OrderBy(x => x.DisplayName)) {
BuildConstructorRow(html, member);
}
html.End() // table
.EndSection();
}
if(type.Fields.Any()) {
html.StartSection(2, "fields", "Fields")
.Start("table")
.Start("tr").Elem("th", "Visibility").Elem("th", "Description").End();
foreach(var member in type.Fields.OrderBy(x => x.DisplayName)) {
BuildFieldRow(html, member);
}
html.End() // table
.EndSection();
}
if(type.Properties.Any()) {
html.StartSection(2, "properties", "Properties")
.Start("table")
.Start("tr").Elem("th", "Visibility").Elem("th", "Description").End();
foreach(var member in type.Properties.OrderBy(x => x.DisplayName)) {
BuildPropertyRow(html, member);
}
html.End() // table
.EndSection();
}
if(type.Methods.Any()) {
html.StartSection(2, "methods", "Methods")
.Start("table")
.Start("tr").Elem("th", "Visibility").Elem("th", "Description").End();
foreach(var member in type.Methods.OrderBy(x => x.DisplayName)) {
BuildMethodRow(html, member);
}
html.End() // table
.EndSection();
}
if(type.Events.Any()) {
html.StartSection(2, "events", "Events")
.Start("table")
.Start("tr").Elem("th", "Visibility").Elem("th", "Description").End();
foreach(var member in type.Events.OrderBy(x => x.DisplayName)) {
BuildEventRow(html, member);
}
html.End() // table
.EndSection();
}
html.EndSection(); //members
}
示例2: BuildGenericParameterSection
private void BuildGenericParameterSection(int level, XDoc html, XDoc xmlDoc, IEnumerable<ReflectedGenericParameterInfo> genericParameters) {
if(genericParameters.Any()) {
html.StartSection(level, "genericparameters", "Generic Parameters");
foreach(var parameter in genericParameters.OrderBy(x => x.ParameterPosition)) {
html.StartSection(level + 1, "genericparameter", "Parameter " + parameter.Name)
.Div("description", xmlDoc[string.Format("typeparam[@name='{0}']", parameter.Name)])
.StartNameValueBlock("constraints", "Constraints");
var constraints = new List<string>();
if(parameter.MustBeReferenceType) {
constraints.Add("class");
}
if(parameter.MustBeValueType) {
constraints.Add("struct");
}
if(parameter.MustHaveDefaultConstructor) {
constraints.Add("new()");
}
if(constraints.Any() || parameter.Types.Any()) {
html.Start("ul");
foreach(var constraint in constraints) {
html.Start("li").Elem("b", constraint).End();
}
foreach(var parameterType in parameter.Types) {
html.Start("li");
BuildParameterMarkup(html, parameterType);
html.End();
}
html.End(); // ul
} else {
html.Elem("i", "none");
}
html.EndNameValue()
.EndSection();
}
html.EndSection();
}
}
示例3: BuildParameterTable
private void BuildParameterTable(XDoc html, XDoc xmlDoc, IEnumerable<ReflectedParameterInfo> parameters) {
html.StartSection(2, "parameters", "Parameters")
.Start("table")
.Start("tr").Elem("th", "Name").Elem("th", "Type").Elem("th", "Description").End();
foreach(var parameter in parameters.OrderBy(x => x.ParameterPosition)) {
html.Start("tr")
.Start("td").Elem("b", parameter.Name).End()
.Start("td");
if(parameter.IsOut) {
html.Value("out ");
} else if(parameter.IsRef) {
html.Value("ref ");
} else if(parameter.IsParams) {
html.Value("params ");
}
BuildParameterMarkup(html, parameter.Type);
html
.End() // td
.Start("td").AddNodes(xmlDoc[string.Format("param[@name='{0}']", parameter.Name)]).End()
.End(); // tr
}
html
.End() //table
.EndSection();
}
示例4: AddExceptionSection
private void AddExceptionSection(XDoc html, XDoc xmlDoc) {
var exceptions = xmlDoc["exception"];
if(exceptions.ListLength == 0) {
return;
}
html.StartSection(1, "exceptions", "Exceptions")
.Start("table")
.Start("tr").Elem("th", "Exception").Elem("th", "Condition");
foreach(var exception in exceptions) {
var cref = exception["@cref"].AsText;
var info = GetTypeInfo(cref);
if(info == null) {
continue;
}
html.Start("tr")
.Start("td");
if(IsTypeInDocumentation(info.Type)) {
html.Link(info.UriPath, info.DisplayName);
} else {
html.Value(info.DisplayName);
}
html.End() // td
.Start("td").AddNodes(exception).End()
.End(); // tr
}
html.End() // table
.EndSection();
}