LifetimeStrategyOverride aspect can be applied on assembly level to override the Life-Time Strategies for a specific type. This is used for example in Island RTL for Windows to give special behavior to
rtl.winrt.HString type and have it behave as proper strings.
[assembly: RemObjects.Elements.System.LifetimeStrategyOverrideAttribute(typeOf(rtl.winrt.HSTRING), typeOf(HString_Helper))]
The first parameter specifies the type for which to override the stragtegy, in this case
rtl.winrt.HString. The second is the helper type that implements the special behavior.
The helper must be a
struct with a single field of the target type. This helper must define operators such as
assign, a copy constructor and a finalizer.
Please refer to the
HString_Helper in the Island RTL source code on GitHub for ann example.
LifetimeStrategyOverride aspect is available on the Island-backed platform only.