Skip to content

winscripter/AddWithXmlDoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📃 AddWithXmlDoc

Shield Shield

A Visual Studio extension that lets you generate common methods in C# - parameterless constructors, GetHashCode, Equals, and equality operators - with XML documentation automatically inserted for you.

❓ How does it work?

When you install the extension, you get 7 new code actions for classes and structs!

  • XML: Add Equality Methods to Fields: When you click this, it generates GetHashCode, Equals, IEquatable, and equality operators for all fields, + XML documentation.
  • XML: Add Equality Methods to Properties: Same as the one above, but for properties.
  • XML: Add Equality Methods to Members: Same as the one above, but for both Fields and Properties.
  • XML: Add Parameterless Constructor: Adds an empty constructor without any parameters, with XML documentation
  • There's also the three other options: Equality methods, but with (Use inheritdoc). These apply an <inheritdoc cref="..." /> to methods like GetHashCode, IEquatable.Equals, and object.Equals.

Screenshot

You no longer have to manually write XML documentation for methods like GetHashCode or Equals - even an <inheritdoc ... /> can take some time to write! AddWithXmlDoc does that for you.

Installation

Go to the Shield, and click the green "Download" button to get the VSIX.

Double click the VSIX, and that's it! Wait for it to install, and AddWithXmlDoc will be installed on your Visual Studio installation.

✨ Example

Imagine we have a class:

public class Class1
{
    public string Greeting { get; set; }
        = "Welcome to AddWithXmlDoc!"
}

Right click on Class1. Click XML: Add Parameterless Constructor. Our class now looks like this.

public class Class1
{
    public string Greeting { get; set; }
        = "Welcome to AddWithXmlDoc!"

    /// <summary>
    /// Initializes a new instance of the <see cref="Class1" /> class.
    /// </summary>
    public Class1()
    {
    }
}

It also supports generating GetHashCode(), IEquatable.Equals, object.Equals, ==, and !=. Examples of generated code for such methods are documented in the docs. (See below)

📄 Docs

See docs.md

🧱 Prerequisites

AddWithXmlDoc supports all Visual Studio versions starting from Visual Studio 2022. You should have Visual Studio versions at least 2022 to use AddWithXmlDoc.

📦 Building

You'll have to have Visual Studio workloads .NET Desktop Development and Visual Studio extension development prior to building AddWithXmlDoc. After that, open the solution VSAddWithXmlDoc.sln, and click Ctrl+Shift+B in Visual Studio to build the entire solution!

❔ Got any questions?

Feel free to create an Issue post on the GitHub Repository if you have any questions, found a bug, or proposing a suggestion! I will be happy to respond or help.

❤️ How can I help?

If you've tried our extension and you'd like to help:

  • You can star our GitHub Repository if you like the extension,
  • You can give a ★★★★★ rating on the Visual Studio Marketplace if you really like the extension,
  • You can recommend the extension to others, like coworkers, friends, or colleagues, if you really really like the extension,

Every bit of support means a lot to me - thank you for being part of this journey!

🤗 Author

winscripter

🪪 License

Copyright (c) 2023-2025, winscripter

See the file LICENSE.txt for licensing information.