c# - In Visual Studio Immediate window, why do I get Equals/GetHashCode/GetType/ToString as IntelliSense options for Button object? -
c# - In Visual Studio Immediate window, why do I get Equals/GetHashCode/GetType/ToString as IntelliSense options for Button object? -
i in click() method button, , sender button object. want access actualwidth fellow member of said button, when type "sender." intellisense options, following:
1) these options, , 2) why don't following, expecting?
3) how can access actualwidth through sender in debugger?
edit:
in immediate window, casting sender button not help:
it because accessing button object in event, received object
.
private void button1_click(object sender, eventargs e) //^^^^^^^^^^^^ { }
these methods (equals, gethashcode, tostring, gettype) available object
class, , why seeing these.
see: object class (c# - msdn)
because classes in .net framework derived object, every method defined in object class available in objects in system.
(also see: not derives object - eric lippert)
to utilize object button
have cast button object like:
private void button1_click(object sender, eventargs e) { button button = sender button; if (button != null) { //use properties } }
for immediate window:
you not using ()
while casting it, cast like:
((button)sender).
c# wpf visual-studio-2010 debugging
Comments
Post a Comment