私はC#が初めてで、数週間ゆっくりと学習しており、基本的なJavaScriptをいくつか知っています。
3 つのボタンで文字列または int の値を異なるボタンで異なる値に変更してから、すべてのボタンが共有する共通のイベントを開始したくありません。それらをコピーして貼り付けることができることはわかっていますが、コードを短くしたいと考えています。
protected void btn1_Click(object sender, EventArgs e)
{
string example = a;
//Start the MainEvent
}
protected void btn2_Click(object sender, EventArgs e)
{
string example = b;
//Start the MainEvent
}
protected void btn3_Click(object sender, EventArgs e)
{
string example = c;
//Start the MainEvent
}
protected void MainEvent(object sender, EventArgs e)
{
//Content of MainEvent. Result of MainEvent is determined by the value of "Example".
}