Class SerializedParam
An abstract base class for serializing and working with parameters/settings associated with items
Also implements ICloneable to ensure parameters can be copied and passed around as strings
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
[DataContract]
public abstract class SerializedParam : ICloneable
Constructors
SerializedParam()
Declaration
protected SerializedParam()
Methods
Clone()
Creates an entire new instance of this SerializedParam with all the same values as this one
Declaration
protected SerializedParam Clone()
Returns
Type | Description |
---|---|
SerializedParam | An entire new instance of a SerializedParam with all the same property values as this one |
CopyFromParam(SerializedParam)
Should be overridden by inheriting implementations to ensure all parameters values are copied from the specified
source
Declaration
protected virtual void CopyFromParam(SerializedParam source)
Parameters
Type | Name | Description |
---|---|---|
SerializedParam | source | The source instance of a SerializedParam that is of the same type as this one to copy parameter values from |
Remarks
Used by the generic implementation of Clone()
CreateNewParam()
Must be implemented by inheriting classes to provide a new instance of the current class type.
Used when cloning this SerializedParam to create a new instance of the same type
Declaration
protected abstract SerializedParam CreateNewParam()
Returns
Type | Description |
---|---|
SerializedParam | A new instance of the current SerializedParam type |
GetParam(byte[]?)
Given a serialized byte array this deseralizes it and returns the instance as a SerializedParam
Declaration
public static SerializedParam? GetParam(byte[]? data)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | The serialized byte array of this SerializedParam |
Returns
Type | Description |
---|---|
SerializedParam | A deserialized version of this SerializedParam |
GetParam(string?)
Given a serialized string this deseralizes it and returns the instance as a SerializedParam
Declaration
public static SerializedParam? GetParam(string? param)
Parameters
Type | Name | Description |
---|---|---|
string | param | The serialized string of this SerializedParam |
Returns
Type | Description |
---|---|
SerializedParam | A deserialized version of this SerializedParam |
GetParam(string?, bool)
Given a serialized string this deseralizes it and returns the instance as a SerializedParam
Declaration
public static SerializedParam? GetParam(string? param, bool throwOnError = true)
Parameters
Type | Name | Description |
---|---|---|
string | param | The serialized string of this SerializedParam |
bool | throwOnError | If the |
Returns
Type | Description |
---|---|
SerializedParam | A deserialized version of this SerializedParam |
GetParam<T>(byte[]?)
Given a serialized byte array this deseralizes it and returns the instance as a SerializedParam of type
T
Declaration
public static T? GetParam<T>(byte[]? data) where T : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | The serialized byte array of this SerializedParam |
Returns
Type | Description |
---|---|
T | A deserialized version of this SerializedParam as type |
Type Parameters
Name | Description |
---|---|
T | The type this serialized parameter resolves to (or one of its base types) |
GetParam<T>(string)
Given a serialized string this deseralizes it and returns the instance as a SerializedParam of type
T
Declaration
public static T? GetParam<T>(string param) where T : SerializedParam
Parameters
Type | Name | Description |
---|---|---|
string | param | The serialized string of this SerializedParam |
Returns
Type | Description |
---|---|
T | A deserialized version of this SerializedParam as type |
Type Parameters
Name | Description |
---|---|
T | The type this serialized parameter resolves to (or one of its base types) |
ToSerializedBytes()
Serializes this SerializedParam class as a byte array
Declaration
public byte[] ToSerializedBytes()
Returns
Type | Description |
---|---|
byte[] | A byte array serialization of this SerializedParam instance |
ToSerializedString()
Serializes this SerializedParam class as a string
Declaration
public string ToSerializedString()
Returns
Type | Description |
---|---|
string | A string serialization of this SerializedParam instance |