DebuggerDisplay属性可以应用于不拥有的类型吗? [英] Can the DebuggerDisplay attribute be applied to types one doesn't own?
本文介绍了DebuggerDisplay属性可以应用于不拥有的类型吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢 DebuggerDisplay
属性。我非常喜欢它,我想使用它没有源代码的类型。
I like the DebuggerDisplay
attribute. I like it so much, that I want to use it on types that I don't have the source code for.
这是可能吗?
推荐答案
为外部类型设置DebuggerDisplay的示例(System.Collections.Generic.KeyValuePair< TKey,TValue>)将以下内容添加到AssemblyInfo.cs: / p>
Example of setting DebuggerDisplay for a foreign type (System.Collections.Generic.KeyValuePair<TKey,TValue>) add the following to AssemblyInfo.cs:
using System.Collections.Generic;
using System.Diagnostics;
[assembly: DebuggerDisplay("[Key={Key}, Value={Value}]", Target = typeof(KeyValuePair<,>))]
(在VS2015中测试)
(Tested in VS2015)
这篇关于DebuggerDisplay属性可以应用于不拥有的类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文