I'm having trouble getting the generic parameters for the two methods below to display the types in Intellisence.
For the IEnumerable<T>
I just simply want it to show as double
.
And for the IDictionary<TKey,TValue>
overload, I want it to show KeyValuePair<int,string>
but of course without hard-coding the types.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Common.FluentValidation
{
public static partial class Validate
{
/// <summary>
/// Compares two dictionaries are null or contain equal sets of items.
/// Returns true if both instances are null or contain equal sets of <see cref="T:System.Collections.Generic.KeyValuePair'1{TKey}{TValue}"></see> items; otherwise, false.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="A">The first instance to compare</param>
/// <param name="B">The second instance to compare</param>
/// <returns>true if both instances are null or contain equal sets of <see cref="T:System.Collections.Generic.KeyValuePair'1{TKey}{TValue}"></see> items; otherwise, false.</returns>
public static bool AreBothNullOrEqualSets<TKey, TValue>(IDictionary<TKey, TValue> A, IDictionary<TKey, TValue> B)
{
// XOR for null
if ((A == null) ^ (B == null))
return false;
// Compare each value in set
if (A != null)
if (!A.OrderBy(x => x.Key).SequenceEqual(B.OrderBy(x => x.Key)))
return false;
return true;
}
/// <summary>
/// Compares two sequences are null or contain equal sets of items.
/// Returns true if both instances are null or contain equal sets of <see cref="T:Common.FluentValidation.AreBothNullOrEqualSets`1"/> items; otherwise, false.
/// </summary>
/// /// for more information.
/// <typeparam name="T">The type of the enumerable.</typeparam>
/// <param name="A">The first instance to compare</param>
/// <param name="B">The second instance to compare</param>
/// <returns>true if both instances are null or contain equal sets of <see cref="T:Common.FluentValidation.AreBothNullOrEqualSets`1"/> items; otherwise, false.</returns>
public static bool AreBothNullOrEqualSets<T>(IEnumerable<T> A, IEnumerable<T> B)
{
// XOR for null
if ((A == null) ^ (B == null))
return false;
// Compare each value in set
if (A != null)
if (!A.SequenceEqual(B))
return false;
return true;
}
}
}
I searched and found a few hints, but have attempted several things with no luck. Best I can get is for it to just display "T" in the Intellisence balloon, which leaves something to be desired...
- http://msdn.microsoft.com/en-us/library/acd0tfbe%28VS.85%29.aspx
- reference to generic type in XML code comment
- How to reference generic classes and methods in xml documentation
- Generics in XML documentation issue
- using see cref with < > characters in XML Documentation?
- XML Documentation: <see> tag with multiple generic type parameters
EDIT:
Here's Microsoft doing it on the class level type params... but not on the constructor... So is this possible for methods/constructors? (ideally I want to show the types inlined with my comments, but the way it is in the example image below is perfectly acceptable as well)