在 LINQPad 中,结果具有 NULL 的特殊样式。如何将其应用于布尔值或其他值?
我希望能够设计不同的返回值,类似于 LINQPad 将 NULL 设计为斜体绿色文本的方式。具体来说,我想以不同的方式设置布尔值 TRUE 和 FALSE 的样式,例如蓝色和红色。
I would like to be able to style different return values similar to how LINQPad styles NULL as italic green text. Specifically, I would like to style Boolean values TRUE and FALSE differently like blue and red.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这无法通过内置样式表编辑器来完成。但是,您可以编写一个调用的扩展方法,如下所示:
如果将扩展方法放入 VS 项目并将 DLL 复制到 LINQPad 插件文件夹中,它将自动可供所有查询使用。
编辑:您现在可以在“我的扩展”查询中定义该方法,而不必在 VS 中创建项目。
This can't be done through the built-in stylesheet editor. However you could write an extension method that you invoke as follows:
If you put the extension method into a VS project and copy the DLL into the LINQPad plugins folder, it will be automatically available to all queries.
EDIT: You can now define that method in the 'My Extensions' query rather than having to create a project in VS.
我在 MyExtensions 草图中成功使用了以下代码块:
I have success with this code block in MyExtensions sketch: