我有一个DumpContainer我想动态添加内容的项目。我知道我可以将该Content属性设置为一个新对象,但这会删除以前的内容。
如何添加而不是替换?
感谢您的帮助。
还有几个选项:
如果您希望项目垂直显示,但不在表格中,请Util.VerticalRun在 a 内使用DumpContainer:
var content = new List<object>();
var dc = new DumpContainer (Util.VerticalRun (content)).Dump();
content.Add ("some text");
dc.Refresh();
content.Add (new Uri ("http://www.linqpad.net"));
dc.Refresh();
Run Code Online (Sandbox Code Playgroud)
如果项目是异步生成的,请使用异步流 (C# 8):
async Task Main()
{
// LINQPad dumps IAsyncEnumerables in the same way as IObservables:
RangeAsync (0, 10).Dump();
}
public static async IAsyncEnumerable<int> RangeAsync (int start, int count)
{
for (int i = start; i < start + count; i++)
{
await Task.Delay (100);
yield return i;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
797 次 |
| 最近记录: |