예제 #1
0
        public void Serialize(object data, IPropertyVisitor visitor, ObjectSerializerSettings settings = null)
        {
            Visitor = visitor;
              Settings = settings ?? new ObjectSerializerSettings();

              if (data != null && data.GetType() != DataType)
            throw new ArgumentException(string.Format("Cannot serialize {0} - expected {1}.", data.GetType(), DataType), "data");

              visitor.Begin();
              Serialize(data, DataType, "");
              visitor.End();
        }
예제 #2
0
        public void Serialize(object data, IPropertyVisitor visitor, ObjectSerializerSettings settings = null)
        {
            Visitor  = visitor;
            Settings = settings ?? new ObjectSerializerSettings();

            if (data != null && data.GetType() != DataType)
            {
                throw new ArgumentException(string.Format("Cannot serialize {0} - expected {1}.", data.GetType(), DataType), "data");
            }

            visitor.Begin();
            Serialize(data, DataType, "");
            visitor.End();
        }