Gears
API ReferenceAttributes

SettingParserAttribute

Marks a static method as the parser for a value type.

Sealed classNamespace GearsAPI.AttributesAssembly GearsAPI.dllSource
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class SettingParserAttribute : Attribute

Marks a static method inside a SettingsSerializationProvider class as the parser for a value type. The method must have the signature static T Method(string); a mismatch throws InvalidOperationException when Gears scans it. One parser is registered per value type across the whole game, and the last one scanned wins. Registering a type Gears already handles replaces its handler, and two mods registering the same type silently overwrite each other, so register only types your own mod owns.

Inheritance: Object → Attribute → SettingParserAttribute
Attributes: AttributeUsageAttribute

Declared in SettingsParserAttribute.cs — the file name carries an extra s that the type name does not.

Constructors

SettingParserAttribute(Type)

public SettingParserAttribute(Type valueType)

Initializes the attribute for valueType.

Properties

ValueType

public Type ValueType { get; }

Gets the type the method parses.

On this page