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.
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 generatesGetHashCode
,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.
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.
Go to the , 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.
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)
See docs.md
AddWithXmlDoc supports all Visual Studio versions starting from Visual Studio 2022. You should have Visual Studio versions at least 2022 to use AddWithXmlDoc.
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!
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.
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!
Copyright (c) 2023-2025, winscripter
See the file LICENSE.txt for licensing information.