EnvDTE.Expression - 以编程方式获取 DataMembers 的内部名称
假设我有 C# 代码行:
var myList = new List {1,2,3};
我将“myList”放入“监视”窗口中,然后向下拖动列表的第一项,监视窗口将使用该数据成员的内部名称创建一个新行,在本例中为
(new System.Collections. Generic.Mscorlib_CollectionDebugView(myList)).Items[0]
我的问题是,有没有办法以编程方式从 EnvDTE 的表达式的 DataMember 获取此内部名称?
多谢!
Supposing I have the C# code line:
var myList = new List {1,2,3};
And I put "myList" in the Watch window, and then drag the 1st item of the list down, the watch window creates a new line with the internal name of this data member, which in this case would be
(new System.Collections.Generic.Mscorlib_CollectionDebugView(myList)).Items[0]
My question is, is there a way to programmatically get this internal name from an EnvDTE's Expression's DataMember?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有完整的配方,但我看到
List
的自定义属性System.Diagnostics.DebuggerTypeProxyAttribute
设置为ProxyTypeName
设置为System.Collections.Generic.Mscorlib_CollectionDebugView'1
。据我了解,这意味着在监视窗口中您实际上看到的是代理类型,而不是原始类型。也许这可以为您指明正确的方向。为了获得我所做的属性:
I do not have the complete recipe, but I see that
List<T>
has custom attributeSystem.Diagnostics.DebuggerTypeProxyAttribute
set withProxyTypeName
set toSystem.Collections.Generic.Mscorlib_CollectionDebugView'1
. Which, as I understand, means that in the watch windows you actually see that proxy type, not the original one. Maybe this can point you in the right direction.To get the attribute I did:
不,你就是不能。你必须自己动手。
No, you just can't. You have to roll your own.