コード例 #1
0
ファイル: DictionaryConverter.cs プロジェクト: miqui/Ramone
    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;
    }
コード例 #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);
        }