ToString

The ToString aspect can be used in cross-platform code to mark the method that returns the canonical string representation of the object.

Using this attribute makes it easier to implement this common method in cross-platform code, despite the fact that the different platforms expect slightly different naming conventions (ToString on .NET and Island, toString on Java and description on Cocoa) and call semantics (e.g. virtuality and nullability).

A single method on a class that takes no parameters and returns a String may be annotated with the aspect, and the compiler will automatically adjust it internally to implement the appropriate method for each platform.

[ToString]
method NameDoesNotMatter: String;
begin
  ...
end;
[ToString]
public string NameDoesNotMatter()
{
    ...
}
@ToString
public func NameDoesNotMatter() -> String {
    ...
}
@ToString
public string NameDoesNotMatter()
{
    ...
}

Defined in RemObjects.Elements.Cirrus.dll

See Also