Powershell-INotifyPropertyChanged可以本地实现吗? [英] Powershell - can INotifyPropertyChanged be implemented natively?

查看:70
本文介绍了Powershell-INotifyPropertyChanged可以本地实现吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道INotifyPropertyChanged接口是否可以在Powershell中的对象上本地实现,而无需构建C#类和使用Add-Type生成新的.NET程序集吗?

Does anyone know if the INotifyPropertyChanged interface can be implemented on an object in Powershell natively, without building a C# class and using Add-Type to generate a new .NET assembly?

我已经用Google搜索了我能想到的所有内容,但找不到解决方法.

I've Googled everything I can think of and haven't been able to find a solution.

谢谢.

推荐答案

否.考虑PowerShell是一种CLI consumer语言,而不是producer语言.那就是您可以构造和使用大多数.NET类型.但是,PowerShell本身不提供创建新.NET类型的工具,更不用说实现接口的类型了.虽然您可以在PowerShell中创建自定义对象,并使用技巧为这些对象赋予PowerShell可以理解的类型名称,但这些技巧不适用于WPF等.NET库.

No. Consider PowerShell a CLI consumer language and not so much a producer language. That is you can construct and use most .NET types. However PowerShell doesn't natively provide a facility to create new .NET types much less types that implement interfaces. While you can create custom objects in PowerShell and use tricks to give those objects a type name that PowerShell understands, those tricks don't work with .NET libraries like WPF.

这篇关于Powershell-INotifyPropertyChanged可以本地实现吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆