Error SA1611 on documenting an indexer

Feb 12, 2011 at 8:54 PM

The following indexer gets a SA1611 worning. What is the correct syntax?

// <copyright file="IDingbat.cs" company="Clive Chinery">
// Copyright LGPL (c) 2011 All Right Reserved
// </copyright>

namespace Demo
{
  using System.Collections;

  /// <summary>
  /// Dingbat Sample Interface
  /// </summary>
  public interface IDingbat : IEnumerable
  {
    /// <summary>
    /// Gets the <see cref="System.Object"/> with the specified key.
    /// </summary>
    /// <remarks></remarks>
    object this[string key]
    {
      get;
    }
  }
}

 

 

Warning   

SA1611: The documentation header must contain param tags matching the element's parameter list.    

Developer
Feb 13, 2011 at 6:22 AM

SA1611 rule forces you to describe every parameter (it's written there, isn't it?).
If you wish to use it, you should describe parameter key in your indexer. 

/// ...
/// </summary>
/// <param name="key">
The key of the value to get.</param>

P.S. Also I would recommend always putting a point at the end of summary phrases (SA1629 rule):

/// <summary>
/// Dingbat sample interface.
/// </summary>

Best regards,
Oleg Shuruev. 

Feb 13, 2011 at 2:22 PM

Thank you!