Exemple #1
0
 public string Serialize(object obj, Type type, StringSerializer stringSerializer)
 {
     try
     {
         builder.Clear();
         foreach (var fi in type.GetFields())
         {
             if (builder.Length != 0)
             {
                 builder.Append(' ');
             }
             builder.Append(fi.Name).Append(' ').Append(stringSerializer.Serialize(fi.GetValue(obj), fi.FieldType));
         }
         return(builder.ToString());
     }
     catch (Exception ex)
     {
         Console.WriteLine("ValueTypeSerializer.Serialize exception!");
     }
     return(StringSerializer.Unknown);
 }
 public string Serialize(object obj, Type type, StringSerializer stringSerializer)
 {
     return(stringSerializer.Serialize(obj, Enum.GetUnderlyingType(type)));
 }