FormatTimeSpan() static private method

static private FormatTimeSpan ( System.TimeSpan value ) : string
value System.TimeSpan
return string
Exemplo n.º 1
0
        /// <summary>
        /// Returns a string representation of the WriteConcern.
        /// </summary>
        /// <returns>A string representation of the WriteConcern.</returns>
        public override string ToString()
        {
            List <string> parts = new List <string>();

            if (_fsync != null)
            {
                parts.Add(string.Format("fsync={0}", _fsync.Value));
            }
            if (_journal != null)
            {
                parts.Add(string.Format("journal={0}", _journal.Value));
            }
            if (_w != null)
            {
                parts.Add(string.Format("w={0}", _w));
            }
            if (_wTimeout != null)
            {
                parts.Add(string.Format("wtimeout={0}", MongoUrlBuilder.FormatTimeSpan(_wTimeout.Value)));
            }

            if (parts.Count == 0)
            {
                return(Enabled ? "w=1" : "w=0");
            }
            else
            {
                return(string.Join(",", parts.ToArray()));
            }
        }