RoboZhando/Redis/Serialize/RedisConvert.cs
/// <summary>
/// Serializes a object into a single dictionary
/// </summary>
/// <param name="buffer">The dictionary that all the keys will be inserted into</param>
/// <param name="obj">The object to parse</param>
/// <param name="subkey">The current subkey</param>
Serializes a object into a single dictionary
Serializes a object into a single dictionary
public static void Serialize(Dictionary<string, string> buffer, object obj, string subkey = "")
		{
			Type type = obj.GetType();
			RedisOptionAttribute options = type.GetCustomAttribute<RedisOptionAttribute>();
			foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
				SerializeMember(buffer, new SerializeMember(property), obj, subkey);
			foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
				SerializeMember(buffer, new SerializeMember(field), obj, subkey);
		}
public static void Serialize ( Dictionary < string , string > buffer , object obj , string subkey = " " ) { Type type = obj . GetType ( ) ; RedisOptionAttribute options = type . GetCustomAttribute < RedisOptionAttribute > ( ) ; foreach ( var property in type . GetProperties ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ) SerializeMember ( buffer , new SerializeMember ( property ) , obj , subkey ) ; foreach ( var field in type . GetFields ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ) SerializeMember ( buffer , new SerializeMember ( field ) , obj , subkey ) ; }
Serializes a object into a single dictionary
Serializes a object into a single dictionary
//Prepare the type and initial options //See if we should override the options //Iterate over every property //Iterate over every field
buffer
Dictionary<string, string>
The dictionary that all the keys will be inserted into
The dictionary that all the keys will be inserted into
obj
object
The object to parse
The object to parse
subkey
string
The current subkey
The current subkey