最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Format

运维笔记admin15浏览0评论

Format

Format

mkl*_*nt0 5

Markdig.Syntax.Inlines.LinkInline本身实现IEnumerable,这导致Format-List枚举它并报告枚举元素的属性,即使通过-InputObject.

具体来说,它枚举了实例的一个子元素,它的类型为Markdig.Syntax.Inlines.LiteralInline,并且正在显示它的属性。

为防止这种枚举,即查看实例本身的属性,您必须将其包装在 aux 中。单元素数组:

Format-List -InputObject (, $links[0])

输出:

Url : linkpath.mdGetDynamicUrl : Title : Label : IsImage : FalseIsShortcut : FalseIsAutoLink : FalseReference : ParentBlock : FirstChild : this is a linkLastChild : this is a linkParent : {blah, Markdig.Syntax.Inlines.CodeInline, nHello , this is a link}PreviousSibling : nHello NextSibling : IsClosed : TrueColumn : 0Line : 0UrlSpan : 0-0TitleSpan : 0--1LabelSpan : 0-0Span : 0-0

获取属性名称的更简单方法是通过内部.psobject属性:

$links[0].psobject.Properties.Name

笔记:

问题归结为Markdig.Syntax.Inlines.LinkInline不被视为类似集合的类型,但其IEnumerable接口的实现使 PowerShell 将其视为集合。

为了使 .NET 类型对 PowerShell 友好,它们需要通过实现的属性IEnumerable公开枚举,例如.Children在这种情况下,而不是实现IEnumerable 自身。

Format

发布评论

评论列表(0)

  1. 暂无评论