c# - 是否可以通过 Foundation 的 NSNotificationCenter 传递 .net 数据?
问题描述
我在 Xamarin 上开发一个 .net 移动跨平台应用程序。
我想将数据从 ViewController A 发送到 ViewController B。在我的 ViewController A 中,我有一本字典。在我的 ViewController B 中,我想创建/编辑一个键/值对并将其添加回我的 ViewController A 中的字典。
为此,我想我使用 NSNotificationCenter。
但是,NSNotificationCenter 只允许将数据作为 NSObject(来自 Foundation 框架)传递。我需要发送的数据来自 .net Framework Dictionary(来自 System.Collections.Generic)。
实现这种数据传输的最佳实践是什么?
我已经尝试过在 .net 和基础框架之间进行明确的数据转换,并做一些诸如“NSObject.FromObject(keyValuePair)”之类的事情。不知道能不能逆向操作...
解决方案
推荐阅读
- android - 无法在 genymotion 中安装 apk
- objective-c - 如何检查当前加载的视图控制器?(ObjC + 斯威夫特)
- android - 带有 Android 皮肤的模拟器上的右侧菜单按钮
- java - 如何通过 http 更有效地下载大文件?
- linux - 从 Ubuntu 18.04 升级到 18.10 后,我收到 Sendmail-Base 错误
- php - 使用 AJAX 定期将数据重新发布到 Laravel 后端时出现问题
- xamarin - 如何在主详细信息页面中自定义标签页?
- php - 如何从网站的谷歌分析中查询数据?
- android - Firebase Cloud Firestore 代码
- java - 如何为每个对象创建一个对象集合