示例#1
0
        public string SerializeToString(T value)
        {
            if (value == null)
            {
                return(null);
            }
            if (value is string)
            {
                return(value as string);
            }

            var sb = new StringBuilder();

            using (var writer = new StringWriter(sb))
            {
                JsvWriter <T> .WriteObject(writer, value);
            }
            return(sb.ToString());
        }
示例#2
0
 public void SerializeToWriter(T value, TextWriter writer)
 {
     JsvWriter <T> .WriteObject(writer, value);
 }