Пример #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;
    }
        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);
        }