Hi,
I am familiar with this piece of code:
LinkButton myLb = (LinkButton)sender;
string cmd2 = myLb.CommandName;
string cmd2 = myLb.CommandName;
However I came across this new code to me , but it does the same thing as the upper code.
string cmd = (sender as LinkButton).CommandName;
my question, is this a way of casting. How do I know when to use this kind of conversion.
Thanks
Al

Jin NecesarioRank #173 · 13.9K reputationPosted Apr 25, 2020, 4:05 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 25, 2020, 7:51 PM EDT