In order to be a neat programmer I try to fix the build warnings. But I get stuck with the warnings for unused parameters in page event handlers. Example:
public partial class MyPage : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
some code not referencing sender or e
}
If I would follow upon the recommendation of VisualStudio and remove the unused parameters sender
and e
, I would alter the method signature and the code might not work correctly. However, according to this microsoft help page the signature for event handlers does not look at the parameters. The language of that page is confusing to me, with jargon like breaking
, but in this case I guess that it is indeed safe to remove the unused parameters.
But how about the next event handler, where the arguments are also not used, but VisualStudio does NOT issue the same warning:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack && !IsCallback)
InitPagina();
return;
}
My questions are:
breaking
in the help page?To answer my own questions, in order:
breaking
, if they talk about debatable things like "unneeded"; I'd propose new jargon like unneeded build warnings