Breyta

Deila með


Platform::Metadata::RuntimeClassName

When applied to a class definition, ensures that a private class returns a valid name from the GetRuntimeClassName function..

Syntax

[Platform::Metadata::RuntimeClassName] name

Parameters

name
The name of an existing public type that is visible in the Windows Runtime.

Remarks

Use this attribute on private ref classes to specify a custom runtime type name and/or when the existing name does not meet the requirements. Specify as a name a public interface that the class implements.

Example

The following example shows how to use the attribute. In this example, the runtime type name of HellowWorldImpl is Test::Native::MyComponent::IHelloWorld

namespace Test
{
    namespace Native
    {
        namespace MyComponent
        {
            public interface class IHelloWorld
            {
                Platform::String^ SayHello();
            };

            private ref class HelloWorldImpl sealed :[Platform::Metadata::RuntimeClassName] IHelloWorld
            {
            public:
                HelloWorldImpl();
                virtual Platform::String^ SayHello();
            };

            Platform::String^ HelloWorldImpl::SayHello()
            {
                return L"Hello World!";
            }
        }
    }
}

See also

Platform::Metadata Namespace