EnvDTE.Expression - Getting the internal name of DataMembers programmatically
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!
I do not have the complete recipe, but I see that List<T>
has custom attribute System.Diagnostics.DebuggerTypeProxyAttribute
set with ProxyTypeName
set to System.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:
myList.GetType().GetCustomAttributes(false);
No, you just can't. You have to roll your own.
精彩评论