static
class
Ron
Ron Serialization/Deserialization API.
static
bool
TryTokenize
(string source,out TokenList<RonTokenKind> result,out Exception exception)
Try to tokenize the input.
If successful returns the result.
Otherwise returns the exception.
source: The ron string to tokenize.
result: The result if successful.
exception: The exception if tokenization fails.
returns: Bool indicating if the tokenization was successful.
static
TokenList<RonTokenKind> Tokenize (string source)
Tokenize the input and return the token list.
source: The ron string to tokenize.
returns: The token list.
static
RonDocument
Parse
(string source)
Parse the source and return the resulting ron document. Throw an exception if not successful.
source: The ron string to parse.
returns: AST tree for the ron string.
static
bool
TryParse
(string source,out RonDocument document)
Try to parse the source, returning the document if successful.
source: The ron string to parse.
document: AST for the ron string if successful.
returns: Bool indicating if parsing was successful.
static
bool
TryParse
(string source,out RonDocument document,out Exception exception)
Try to parse the source, returning the document if successful, or the exception if not successful.
source: The source document to parse.
document: The document if successful.
exception: The exception thrown if not successful.
returns: Bool indicating if parsing was successful.
static
object
Deserialize
(string source,Type? hint)
Deserialize the input, or throw an exception if failed.
source: The Ron string to deserialize.
hint: Type hint for type inference.
returns: The deserialized object.
static
T
Deserialize<T> (string source)
Deserialize the Ron file as type T.
T The type to deserialize as.
source: The ron source code.
returns: The value of T if successful.
static
bool
TryDeserialize
(string source,Type? typeHint,out Object? output)
Try to deserialize the result
source: The Ron string to deserialize.
typeHint: The hint for type inference.
output: The deserialized object if successful.
returns: Bool indicating if deserialization was successful.
static
bool
TryDeserialize
(string source,Type? typeHint,out Object? output,out Exception exception)
Try to deserialize the input, returning an object if successful, or an exception if failed.
source: The Ron string to deserialize.
typeHint: The hint for type inference.
output: The deserialized output if successful.
exception: The exception if serialization was not successful.
returns: Bool indicating if deserialization was successful.
static
string
Serialize
(object source,RonPrintOptions options = null)
Convert an object to a ron string.
source: The Ron string to serialize.
options: Serialization options.
returns: The ron string.
static
void
RegisterType
(params Type[] types)
Register a type that ron knows how to deserialize.
When Ron cannot infer a type from context it will check the type cache for a registered type.
types: The type to be known by Ron.
static
void
RegisterTypeConverter
(Type type,TypeSerializerConverter converter)
Register a serialization converter for a known type.
type: The type that this converter applies to.
converter: The converter for this type.
static
void
RegisterListType
(Type type)
Register a type to serialize as a list.
type: The type to serialize and deserialize as a list.
static
void
RegisterDictionaryType
(Type type)
Register a type to serialize as a dictionary.
type: The type to serialize and deserialize as a dictionary.
static
void
RegisterTupleConverter<T> (Func<T object[]> converter)
Register custom converter to serialize T as a tuple.
T The type to register the custom converter for.
converter: The function to convert the element T to a tuple.
static
void
RegisterProxyType
(Type sourceType,Type proxyType)
Register a proxy type for another type.
sourceType: The source type to be converted to and from a proxy.
proxyType: The proxy type to be serialized as Ron.
static
void
ResetGlobalContext()
Clear all settings in the global context.