如何将“Button b3 = (Button)sender”转换为“Button b3 = (Button)sender”从 C# 到 IronPython

发布于 2024-10-07 14:32:58 字数 95 浏览 0 评论 0原文

我想将 C# 语句转换

Button b3 = (Button)sender;

为ironpython 语句

I want to convert C# statement

Button b3 = (Button)sender;

to ironpython statement

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

表情可笑 2024-10-14 14:32:58

假设 sender 被键入为对象(换句话说,没有用户定义的转换运算符),您可以像 C# 代码中的 b3 一样使用 sender。 完全相同的代码为:

b3 = sender

C# 只需要执行此操作,因为它想要静态类型化对象。如果您不是将 Button 转换为显式实现的对象的接口,那么它会变得更加复杂。

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.

对风讲故事 2024-10-14 14:32:58

b3 = 发送者.Content()

b3 = sender.Content()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文