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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -