Twoorb Plugins  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Twoorb.Utilities.DataFiller Class Reference

A helper class that takes Dictionary(string, objects) and fills a specified class object with its data using System.Reflection. It can also convert class objects into Dictionary(string, objects). Useful for json-string generation with MiniJSON. More...

Static Public Member Functions

static bool Fill (object classObject, Dictionary< string, object > data)
 Fills the member of the class object with information from the dictionary More...
 
static bool ToDictionary (object classObject, out Dictionary< string, object > data, bool subClassAndListToJson=false)
 Converts the members of a class to a dictionary. The resulting Dictionary can be used with a JSON-parser to serialize the class. More...
 

Detailed Description

A helper class that takes Dictionary(string, objects) and fills a specified class object with its data using System.Reflection. It can also convert class objects into Dictionary(string, objects). Useful for json-string generation with MiniJSON.

Member Function Documentation

static bool Twoorb.Utilities.DataFiller.Fill ( object  classObject,
Dictionary< string, object >  data 
)
static

Fills the member of the class object with information from the dictionary

Parameters
classObjectThe class to fill with data
dataThe dictionary with data to fill the class with
Returns
Returns if the operation was successful
static bool Twoorb.Utilities.DataFiller.ToDictionary ( object  classObject,
out Dictionary< string, object >  data,
bool  subClassAndListToJson = false 
)
static

Converts the members of a class to a dictionary. The resulting Dictionary can be used with a JSON-parser to serialize the class.

Parameters
classObjectThe class to extract a dictionary from
dataThe resulting dictionary
subClassAndListToJsonInstead of creating another Dictionary of the subclasses, you can choose to save them as a string instead.
Returns
returns if the operation was successful

The documentation for this class was generated from the following file: