how to convert "Button b3 = (Button)sender" from c# to ironpython
I want to convert C# statement
开发者_运维问答Button b3 = (Button)sender;
to ironpython statement
Assuming sender is typed to object (in other words there are no user defined conversion operators) you can just use sender like you would b3 in the C# code. The exact same code would be:
b3 = sender
C# only needs to do this because it wants to statically type objects. If instead of Button you were casting to an interface for an object where it's explicitly implemented it gets more complicated.
b3 = sender.Content()
精彩评论