Kees C. Bakker
Kees C. Bakker

Reputation: 33381

How to generate snippets from existing code?

I've got some pieces of code I need to turn in to snippets. Anyone know a good tool of visual studio plug-in that can do something like this?

Basically I would like to be able to parameterize code like this:

//MOVE TO TOP!!
private XmlData subject;

/// <summary>
/// Gets or sets the subject.
/// </summary>
/// <value>
/// The subject.
/// </value>
public XmlData Subject
{
    get
    {
        if (subject == null)
        {
            subject = CreateXmlDataInstance(Post_DA.SUBJECT_FIELD);
        }
        return subject;
    }
    set
    {
        subject = value;
    }
}

I hope one of you guys know a good tool.

Upvotes: 1

Views: 134

Answers (1)

dasheddot
dasheddot

Reputation: 2966

I create snippets manually, but maybe a snippet designer like this can help you: SnippetDesigner

I don't think you could do that automatically any way - you have to define which elements to parameterize at least.

Upvotes: 1

Related Questions