예제 #1
0
        public static string Serialize(Money?instance)
        {
            string serialized;

            if (instance.HasValue)
            {
                var surrogate = new CanonicalSurrogate(instance.Value);
                serialized = JsonSerializer.SerializeToString(surrogate);
            }
            else
            {
                serialized = JsonSerializer.SerializeToString(instance);
            }
            return(serialized);
        }
예제 #2
0
        public static string Serialize(Money instance)
        {
            var surrogate = new CanonicalSurrogate(instance);

            return(JsonSerializer.SerializeToString(surrogate));
        }