Обычно, когда обработчик событий Page_Load
добавляется в файл кода Visual Studio (например, дважды щелкнув страницу в режиме конструктора), он выглядит следующим образом:
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
// ...
}
Но Resharper предлагает Name 'Page_Load' does not match rule 'Methods, properties and events'. Suggested name is 'PageLoad'
. Я предполагаю, что есть лучший способ определить обработчик для загрузки страницы, но я не могу вспомнить, что такое синтаксис, но я полагаю, что это разрешит это предупреждение Resharper?
Возможно, что-то вроде:
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// ...
}
но мне кажется, что OnLoad
и PageLoad
не совсем то же самое?