-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-IDEFeature - Extension EverythingThe extension everything featureThe extension everything feature
Description
Version Used:
Steps to Reproduce:
- Create this code:
/// <summary>
/// Provides extension methods for <see cref="IEnumerable{T}"/>-based objects.
/// </summary>
public static class IDictionaryExtensions
{
/// <summary>
/// Adds key-value pairs to <paramref name="self"/>.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="self">The dictionary to add pairs to.</param>
/// <param name="pairs">The pairs to add to <paramref name="self"/>.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="self"/> or <paramref name="pairs"/> is <see langword="null" />.</exception>
public static void AddPairs<TKey, TValue>(this IDictionary<TKey, TValue> self, IDictionary<TKey, TValue> pairs)
{
ArgumentNullException.ThrowIfNull(self);
ArgumentNullException.ThrowIfNull(pairs);
foreach (var (key, value) in pairs)
{
self.Add(key, value);
}
}
}- Use the "Convert all extension methods...." refactoring on this type:
- Note that the refactoring does this to the code:
namespace Spackle.Extensions;
/// <summary>
/// Provides extension methods for <see cref="IEnumerable{T}"/>-based objects.
/// </summary>
public static class IDictionaryExtensions
{
extension<TKey, TValue>(IDictionary<TKey, TValue> self)
{
/// <summary>
/// Adds key-value pairs to <paramref name="self"/>.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="self">The dictionary to add pairs to.</param>
/// <param name="pairs">The pairs to add to <paramref name="self"/>.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="self"/> or <paramref name="pairs"/> is <see langword="null" />.</exception>
public void AddPairs(IDictionary<TKey, TValue> pairs)
{
ArgumentNullException.ThrowIfNull(self);
ArgumentNullException.ThrowIfNull(pairs);
foreach (var (key, value) in pairs)
{
self.Add(key, value);
}
}
}
}Expected Behavior:
The <typeparam> and <param> elements should move to where the extension block is.
Actual Behavior:
The comments are not changed.
According to this doc, these elements should be "on" the extension block, so leaving them on the method leads to an error. Unfortunately, this case has only one method - if there were more, they may be multiple references to <param> and/or <typeparam> so maybe the best action to take is to do nothing, but it also feels kind of wrong to leave those elements in place.
Metadata
Metadata
Assignees
Labels
Area-IDEFeature - Extension EverythingThe extension everything featureThe extension everything feature