KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The Attribute [DebuggerDisplay] ( Using DebuggerDisplayAttribute ) allows to define the display in the Debugger of VS 2010/2008. By modifying AutoExp.cs/.dll, I can even override the display of system types and 3rd party types, e.g. [assembly: DebuggerDisplay (@"\{Name = {Name} FullName = {FullName}}", Target = typeof (Type))] In the inner curly braces I can reference fields, properties and methods. Is it possible to reference extension methods ? As an example, I tried to display shorter type names, e.g. $SCG.Dictionary instead of System.Collections.Generic.Dictionary . I added this to AutoExp.cs: using DbgDisp; [assembly: DebuggerDisplay (@"\{Name = {Name} ShortName = {ShortName()}}", Target = typeof (Type))] namespace DbgDisp { public static class Ext { public static string ShortName (this Type t) { return string.Format ("[{0}]", t.Name); } } // Ext } // DbgDisp but the debugger complains: The name 'ShortName' does not exist in the current context. Am I missing something, or is it just not possible to use extension methods there ? I know I could override ToString () , but that helps only for my own types.
Tags (comma-separated)
Save Edits
Cancel