Is it possible to dynamically generate summary from the description attribute

Viewed 80

This might be me asking for a pink unicorn, but still thought doesn't hurt to ask.

I have an enumeration with description attribute set. Is it possible to assign the message of description attribute as summary? The reason is that it helps with intellisense when using the enum member. Currently I am just duplicating the summary and the description.

public enum UserMessageId
{

    /// <summary>
    /// "This is a sample description."
    /// </summary>
    [Description("This is a sample description.")]    
    E0,
}

Thank you.

1 Answers

I don't know some shorcuts which allow to do this directly (your wish is pretty weird for me). But for example, you can use following trick (it implies usage of git). As I remember, git allows you to run custom script for file every time it was modified. It allows you to modify content of file. All you need is to write following templated summaries

/// <summary>
/// %DESCRIPTION MACRO%
/// <summary>
[Description %PLACE TO INSERT DESCRIPTION MACRO%]

Your script will process such macro in your way. Sorry for absent more detailed technical information, hope it will help. Also you can change script, every time it finds %Some Macro%, it automatically inserts Description attribute after comments at new line. But anyway some parsing is needed

Related