The default string type aspect can be used to set the default type strings and "string"/"String" map to. It is uncommon for developers to use this aspect directly, as it is provided mainly for use within Elements RTL, Delphi RTL and the (legacy) Sugar library.

In code using a library that leverages this aspect, string literals, instead of being interpreted as the default system String type, will be of the specified type instead.

This allows you to, for example, use Elements RTL in your project and have all strings seamlessly be treated as Elements RTL Strings.


[assembly:RemObjects.Elements.System.DefaultStringType['Sugar', typeof(Sugar.String))]
[assembly:RemObjects.Elements.System.DefaultStringType("Sugar", typeof(Sugar.String))]
@assembly:RemObjects.Elements.System.DefaultStringType[("Sugar", typeof(Sugar.String))
@__assembly:RemObjects.Elements.System.DefaultStringType[("Sugar", typeof(Sugar.String))

The first parameter is the namespace that the user has to import or use for the aspect to take effect. The second parameter is a typeOf expression referring to a either a mapped type that maps to the platform String, or a type as implicit cast operators from and to the platform String type.

Refer to the source code of Elements RTL or Delphi RTL for example usage.