AbstractOrdinaryValueTypeProto Class |
Namespace: KSPDev.ConfigUtils
The AbstractOrdinaryValueTypeProto type exposes the following members.
Name | Description | |
---|---|---|
![]() | AbstractOrdinaryValueTypeProto | Default constructor must be the only constructor of the proto. |
Name | Description | |
---|---|---|
![]() | CanHandle | Tells if proto can handle the specified type. |
![]() | ParseFromString | Makes a value from the string representation. |
![]() | SerializeToString | Serializes value into a string. |
Here is how you could implement your own proto to persist string array as a string.
class StringArrayProto : AbstractOrdinaryValueTypeProto { public override bool CanHandle(Type type) { return typeof(string[]) == type; } public override string SerializeToString(object value) { return string.Join(",", (value as string[])); } public override object ParseFromString(string value, Type type) { // Due to check in CanHandle we know the type is string[]. return value.Split(','); } }