c# - Pros and Cons of accessing a UIControl's properties via the sender argument vs directly accessing the variable -
let's have uisegmentedcontrol
var segmentcontrol = new uisegmentedcontrol();
in valuechanged event simple use case such this, there reasons should accessing segmentcontrol's properties via sender argument vs directly accessing variable i've created? if i'm setting event other way don't have access variable i'd forced use sender...
segmentcontrol.valuechanged += (sender, e) => { // there pros doing var selectedsegmentid = (sender uisegmentedcontrol).selectedsegment; };
vs
segmentcontrol.valuechanged += (sender, e) => { // vs this? var selectedsegmentid = segmentcontrol.selectedsegment; };
Comments
Post a Comment