Document key usage in Dictionary
        Posted  
        
            by phq
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by phq
        
        
        
        Published on 2010-04-20T10:18:57Z
        Indexed on 
            2010/04/20
            10:23 UTC
        
        
        Read the original article
        Hit count: 284
        
How can I document the key usage in a Dictionary so that it shows in Visual studio when coding using that object?
I'm looking for something like:
/// <param name="SpecialName">That Special Name</param>
public Dictionary<string,string> bar;
So far the best attempt has been to write my own class:
public class SpecialNameDictionary : IDictionary<string, string>
{
    private Dictionary<string, string> data = new Dictionary<string, string>();
    /// <param name="specialName">That Special Name</param>
    public string this[string specialName]
    {
        get
        {
            return data[specialName];
        }
    }
}
But It adds a lot of code that doesn't do anything. Additionally I must retype every Dictionary method to make it compile.
Is there a better way to achive the above?
© Stack Overflow or respective owner