J'ai écrit la méthode d'extension suivante pour remplacer le NameValueCollection.ToString
:Redéfinition NameValueCollection ToString
public static string ToString(this NameValueCollection a)
{
return string.Join("&", a.AllKeys.Select(k => $"{k}={a[k]}"));
}
Mais il utilise toujours la méthode par défaut ToString
.
Quand j'ajouter le mot-clé override
je reçois une erreur:
'ToString(NameValueCollection)': no suitable method found to override
Et quand j'ajoute new
mot-clé, il dit ce mot-clé new
n'est pas nécessaire:
'ToString(NameValueCollection)' does not hide an inherited member. The new keyword is not required.
Eh bien, j'espérais changer la méthode par défaut, mais cela semble être la seule solution. Merci beaucoup. –