Ejemplo n.º 1
0
    public static Dictionary<string, string> ConvertObjectPropertiesToDictionary(object src)
    {
      Dictionary<string, string> result = new Dictionary<string, string>();

      if (src == null)
        return result;

      Type t = src.GetType();
      ObjectSerializer Serializer = new ObjectSerializer(t);

      DictionaryConverterPropertyVisitor visitor = new DictionaryConverterPropertyVisitor();
      Serializer.Serialize(src, visitor);

      return visitor.Result;
    }
Ejemplo n.º 2
0
        public static Dictionary <string, string> ConvertObjectPropertiesToDictionary(object src)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();

            if (src == null)
            {
                return(result);
            }

            Type             t          = src.GetType();
            ObjectSerializer Serializer = new ObjectSerializer(t);

            DictionaryConverterPropertyVisitor visitor = new DictionaryConverterPropertyVisitor();

            Serializer.Serialize(src, visitor);

            return(visitor.Result);
        }