I have the indexer and want to check if is it not null, and if it is then throw ArgumentNullException, but Gendarme sets the warning
InstantiateArgumentExceptionCorrectlyRule: This method throws ArgumentException (or derived) exceptions without specifying an existing parameter name. This can hide useful information to developers.Fix the exception parameters to use the correct parameter name (or make sure the parameters are in the right order).
public override LocalizedString this[string key]
{
get
{
if (key == null)
{
throw new ArgumentNullException("key");
}
return base[key];
}
set
{
if (key == null || value == null)
{
throw new ArgumentNullException("key");
}
base[key] = value;
}
}
How can I fix my indexer?