gpt4 book ai didi

silverlight-4.0 - INotifyDataErrorInfo.GetErrors 应该返回什么类型的 IEnumerable?

转载 作者:行者123 更新时间:2023-12-04 15:13:36 25 4
gpt4 key购买 nike

令我震惊的是,MSDN 的官方文档没有说明 INotifyDataErrorInfo 的 GetErrors 返回的可枚举的底层对象类型应该是什么:http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifydataerrorinfo.geterrors(v=vs.95).aspx

选项有:System.String、System.Object、MyCustomObject、ISomeOtherShitThatDoesntHaveAnythingToDoWithValidationWhatsoever

任何人都可以向我解释如何在不对其结构做出任何假设的情况下,任意可枚举的对象可以用于通知错误?

最佳答案

docs for INotifyDataErrorInfo 提供更多信息:

The validation errors returned by the GetErrors method can be of any type. However, if you implement a custom error type, be sure to override the ToString method to return an error message. Silverlight uses this string in its default error reporting.

Custom error objects are useful when you provide custom error reporting in the user interface. For example, you can create a template for the reporting ToolTip that binds to an ErrorLevel property in order to display warnings in yellow and critical errors in red.

GetErrors 的示例部分中有一个链接回到那个文档:

For an example of an implementation of this method, see the INotifyDataErrorInfo class overview.


我同意它可能没有那么清楚,但是文档在那里......

关于silverlight-4.0 - INotifyDataErrorInfo.GetErrors 应该返回什么类型的 IEnumerable?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13473919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com