Use Windows (phone) runtime component to share your code

Source: Internet
Author: User
What
Is a Windows runtime component?

A Windows runtime component, sometimes referred to as a 3rd-party windows runtime component, is a component you build to expose functionality to all supported versions. by using the Windows runtime, which is supported on Windows Phone 8 and Windows 8, you
Can create components and call them in a simple and natural way from the language of your choice. the component is built using the Windows runtime component template in Visual Studio. its functionality is output as. winmd file, which contains the metadata
Needed to project the functionality automatically into C #, C ++, VB and JavaScript.

When
To use a Windows runtime component when building an app for Windows Phone 8 and Windows 8

The following list describes when you shoshould consider sharing functionality of your app in Windows runtime component.

  • Harnessing the power of C ++ (when controlling the power of C ++): If your app carries out computationally intensive operations, you might opt to write that code in C ++ to achieve optimal performance. if the code that uses this functionality
    Is written in C # Or VB, You can package the functionality as a Windows runtime component and call the component from your managed code.

  • Crossing language boundaries (cross-language programming): In general, using a Windows runtime component is a great way to expose your code to all supported ages. this is not necessary if your app is written in one language
    And you don't intend to expose any of your functionality to other ages. instead you can compose your app of regular class libraries, portable class libraries or, depending on the size and complexity of your app, just write the whole app in the same project.

  • Using direct3d, Win32 or com APIs (when the system provides interfaces that can only be called using C ++): Windows Phone 8 delivers native API to enable powerful Gaming scenarios, native networking and access to camera API from native code. to use these
    API from managed code, you can wrap this functionality in a Windows runtime component. For more info, see supported
    Win32 APIs for Windows Phone 8 and games for Windows Phone.

  • Using 3rd party libraries (when using a third-party library): In the past, it was difficult to consume a 3rd-party library, written in one language, if your app written in another language. with Windows runtime components, it is possible
    To grab a library, wrap it in a Windows runtime component and expose the functionality to your app written in any supported language.

The preceding list is some of the scenarios where writing a Windows runtime component is a very useful way of sharing code. however, a Windows runtime component is not a standard DLL or assembly. there are very specific requirements you must follow when creating
A Windows runtime component. these requirements include using only allowed data types, handling collections, creating only sealed classes and more. visual Studio will help at compile time, and indicate clearly when something goes wrong.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.