Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ConfigurationEntry.cs « LibGit2Sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7456be3c445ab421cdd8600852a80bc82e6dd6c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.Diagnostics;
using System.Globalization;

namespace LibGit2Sharp
{
    /// <summary>
    /// The full representation of a config option.
    /// </summary>
    /// <typeparam name="T">The configuration value type</typeparam>
    [DebuggerDisplay("{DebuggerDisplay,nq}")]
    public class ConfigurationEntry<T>
    {
        /// <summary>
        /// The fully-qualified option name.
        /// </summary>
        public virtual string Key { get; private set; }

        /// <summary>
        /// The option value.
        /// </summary>
        public virtual T Value { get; private set; }

        /// <summary>
        /// The origin store.
        /// </summary>
        public virtual ConfigurationLevel Level { get; private set; }

        /// <summary>
        /// Needed for mocking purposes.
        /// </summary>
        protected ConfigurationEntry()
        { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
        /// </summary>
        /// <param name="key">The option name</param>
        /// <param name="value">The option value</param>
        /// <param name="level">The origin store</param>
        protected internal ConfigurationEntry(string key, T value, ConfigurationLevel level)
        {
            Key = key;
            Value = value;
            Level = level;
        }

        private string DebuggerDisplay
        {
            get
            {
                return string.Format(CultureInfo.InvariantCulture,
                    "{0} = \"{1}\"", Key, Value);
            }
        }
    }
}