예제 #1
0
        private YamlSerializer(YamlSerializationOptions options = null)
        {
            _globals     = options ?? new YamlSerializationOptions();
            _writer      = new YamlWriter();
            _depth       = 0;
            _allowInline = AllowInline.Nothing;

            Start();
        }
예제 #2
0
        /// <summary>
        /// Serialize object into YAML
        /// </summary>
        /// <remarks>
        /// <c>obj</c> will be recursively traversed and all public properties
        /// will be serialized to the YAML format. The exact formatting and
        /// appearance choices can be set through the global options here or
        /// altered on a property/item basis through property/class attributes.
        /// </remarks>
        /// <param name="obj">Object to serialize</param>
        /// <param name="options">Global options</param>
        /// <returns>String with the YAML representation of <c>obj</c></returns>
        public static string Serialize(object obj, YamlSerializationOptions options = null)
        {
            var s = new YamlSerializer(options);

            if (obj != null)
            {
                s.SerializeItem(obj);
            }
            return(s.Finish());
        }
예제 #3
0
 public CombinedOptions(YamlSerializationOptions options)
 {
     DisableOverrides = options.DisableOverrides;
     IndentStep       = options.IndentStep;
 }