hi
how can I replace if with swtich .
protected void testSwitch( object myObject)
{
if (myObject.GetType() == typeof(Button))
{
Button btnMyObj = (Button)myObject;
btnMyObj.Visible = true;
}
switch (myObject)
{
case myObject.GetType() == typeof(Button):
//...
break;
default:
//...
break;
}
}

Rajanikant HawaldarRank #110 · 20.3K reputationPosted Apr 27, 2020, 5:03 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 27, 2020, 5:15 AM EDT
Jaimin ShethiyaRank #177 · 13.7K reputationPosted Apr 27, 2020, 6:30 PM EDT
can you please try to below code.
let me know if you have any doubt.
Thanks.