Powershell - can INotifyPropertyChanged be implemented natively?

巧了我就是萌 提交于 2019-12-11 09:26:54

问题


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?

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

Thanks.


回答1:


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.



来源:https://stackoverflow.com/questions/21814444/powershell-can-inotifypropertychanged-be-implemented-natively

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!