WinRT中的ComposableAttribute是什么? [英] What is the ComposableAttribute in WinRT?

查看:44
本文介绍了WinRT中的ComposableAttribute是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解WinRT的一些更底层的部分是如何工作的.我遇到了 ComposableAttribute ,这可能是我需要的关键.但是,文档它很薄.

I'm trying to understand how some of the more lower-level portions of WinRT work. I came across the ComposableAttribute which may be the key to what I need. However, the documentation on it is very thin.

指示编程元素的组成方式.

Indicates how a programming element is composed.

如您所知,这实际上并没有告诉我任何事情.有谁知道该属性的用途以及应该做什么?

As you can tell, that doesn't actually tell me anything. Does anyone know what this attribute is used for and what it is suppose to do?

推荐答案

ComposableAttribute 将类型标记为可实例化,以用作跨Windows运行时ABI边界的基类.它与 ActivatableAttribute 相似,后者将一种类型标记为可实例化,可以跨ABI边界进行激活"(即,直接使用而不是不用作基类).Windows运行时基于COM,并不真正支持真正的继承.而是通过元数据欺骗和聚合来伪造继承.

The ComposableAttribute marks a type as being instantiable for use as a base class across the Windows Runtime ABI boundary. It is similar to the ActivatableAttribute, which marks a type as being instantiable for "activation" (i.e. for direct use, not for use not as a base class) across the ABI boundary. The Windows Runtime is based on COM and does not really support real inheritance. Instead, inheritance is faked through metadata trickery and aggregation.

您可以定义自己的可组合类型,但是如果要定义,则必须从平台中的可组合类型派生(这是

You can define your own composable types, but if you do, they must derive from a composable type in the platform (this is one of the metadata rules in the Windows 8 app certification requirements). For Windows 8, this means that your composable types must "derive" directly or indirectly from Windows.UI.Xaml.DependencyObject. Finally, composable types may only be authored using IDL and WRL; neither C++/CX nor .NET can be used to define a composable type.

这篇关于WinRT中的ComposableAttribute是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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