Xamarin 自定义渲染器中的程序集声明
Assembly declaration in Xamarin's custom renderers
我通读了 Xamarin Forms documentation for custom renderers trying to make sense of what the assembly attribute required for each implementation of a renderer actually did. I took a look at the C# documentation for Assemblies,但似乎找不到(简单的)解释。使用文档中概述的 MyEntry 示例,有人可以阐明这个程序集 attribute/what 它实际上发生了什么吗?
为了清楚起见,这些是我正在谈论的声明类型:
[assembly: ExportRenderer (typeof (MyEntry), typeof (MyEntryRenderer))]
[assembly: ExportRenderer (typeof (MyEntry), typeof (MyEntryRenderer))]
MyEntry
是您常用(PCL 或共享)表单库中占位符 class 的名称。
MyEntryRenderer
是您的 iOS/Android/WP 项目中实际平台特定实现 class 的名称。
本质上,您是在告诉表单,"when you need to render MyEntry
on Platform X, use the class MyEntryRenderer
."
我通读了 Xamarin Forms documentation for custom renderers trying to make sense of what the assembly attribute required for each implementation of a renderer actually did. I took a look at the C# documentation for Assemblies,但似乎找不到(简单的)解释。使用文档中概述的 MyEntry 示例,有人可以阐明这个程序集 attribute/what 它实际上发生了什么吗?
为了清楚起见,这些是我正在谈论的声明类型:
[assembly: ExportRenderer (typeof (MyEntry), typeof (MyEntryRenderer))]
[assembly: ExportRenderer (typeof (MyEntry), typeof (MyEntryRenderer))]
MyEntry
是您常用(PCL 或共享)表单库中占位符 class 的名称。
MyEntryRenderer
是您的 iOS/Android/WP 项目中实际平台特定实现 class 的名称。
本质上,您是在告诉表单,"when you need to render MyEntry
on Platform X, use the class MyEntryRenderer
."