本文整理汇总了C#中Microsoft.AspNet.Razor.Parser.SyntaxTree.Block.FindLastDescendentSpan方法的典型用法代码示例。如果您正苦于以下问题:C# Block.FindLastDescendentSpan方法的具体用法?C# Block.FindLastDescendentSpan怎么用?C# Block.FindLastDescendentSpan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Razor.Parser.SyntaxTree.Block
的用法示例。
在下文中一共展示了Block.FindLastDescendentSpan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSelfClosing
private static bool IsSelfClosing(Block beginTagBlock)
{
var childSpan = beginTagBlock.FindLastDescendentSpan();
return childSpan?.Content.EndsWith("/>") ?? false;
}
示例2: GetTagMode
private static TagMode GetTagMode(
string tagName,
Block beginTagBlock,
IEnumerable<TagHelperDescriptor> descriptors,
ErrorSink errorSink)
{
var childSpan = beginTagBlock.FindLastDescendentSpan();
// Self-closing tags are always valid despite descriptors[X].TagStructure.
if (childSpan?.Content.EndsWith("/>") ?? false)
{
return TagMode.SelfClosing;
}
var baseDescriptor = descriptors.FirstOrDefault(
descriptor => descriptor.TagStructure != TagStructure.Unspecified);
var resolvedTagStructure = baseDescriptor?.TagStructure ?? TagStructure.Unspecified;
if (resolvedTagStructure == TagStructure.WithoutEndTag)
{
return TagMode.StartTagOnly;
}
return TagMode.StartTagAndEndTag;
}
示例3: IsSelfClosing
private static bool IsSelfClosing(Block childBlock)
{
var childSpan = childBlock.FindLastDescendentSpan();
return childSpan?.Content.EndsWith("/>", StringComparison.Ordinal) ?? false;
}