예제 #1
0
        public OptionDefinition(
            string feature,
            OptionGroup group,
            string name,
            object?defaultValue,
            Type type,
            bool isPerLanguage
            )
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            this.Feature       = feature;
            this.Group         = group ?? throw new ArgumentNullException(nameof(group));
            this.Name          = name;
            this.DefaultValue  = defaultValue;
            this.Type          = type ?? throw new ArgumentNullException(nameof(type));
            this.IsPerLanguage = isPerLanguage;
        }
예제 #2
0
        internal PerLanguageOption2(
            string feature,
            OptionGroup group,
            string name,
            T defaultValue,
            ImmutableArray <OptionStorageLocation2> storageLocations
            )
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            OptionDefinition = new OptionDefinition(
                feature,
                group,
                name,
                defaultValue,
                typeof(T),
                isPerLanguage: true
                );
            this.StorageLocations = storageLocations;
        }
예제 #3
0
 internal PerLanguageOption2(
     string feature,
     OptionGroup group,
     string name,
     T defaultValue,
     params OptionStorageLocation2[] storageLocations
     ) : this(feature, group, name, defaultValue, storageLocations.ToImmutableArray())
 {
 }
예제 #4
0
        public Option2(string feature, OptionGroup group, string name, T defaultValue, ImmutableArray <OptionStorageLocation2> storageLocations, string?languageName)
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            OptionDefinition      = new OptionDefinition(feature, group, name, defaultValue, typeof(T));
            this.StorageLocations = storageLocations;
            LanguageName          = languageName;
        }
예제 #5
0
        internal PerLanguageOption(string feature, OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations)
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            this.Feature          = feature;
            this.Group            = group ?? throw new ArgumentNullException(nameof(group));
            this.Name             = name;
            this.DefaultValue     = defaultValue;
            this.StorageLocations = storageLocations.ToImmutableArray();
        }
예제 #6
0
파일: Option`1.cs 프로젝트: belav/roslyn
 internal Option(
     string feature,
     OptionGroup group,
     string name,
     T defaultValue,
     ImmutableArray <OptionStorageLocation> storageLocations
     )
     : this(
         new OptionDefinition(
             feature,
             group,
             name,
             defaultValue,
             typeof(T),
             isPerLanguage : false
             ),
         storageLocations
         )
 {
 }
예제 #7
0
 public Option2(string feature, OptionGroup group, string name, T defaultValue, ImmutableArray <OptionStorageLocation2> storageLocations)
     : this(feature, group, name, defaultValue, storageLocations, null)
 {
 }
예제 #8
0
 public Option2(string feature, OptionGroup group, string name, T defaultValue, OptionStorageLocation2 storageLocation)
     : this(feature, group, name, defaultValue, ImmutableArray.Create(storageLocation))
 {
 }
예제 #9
0
 internal PerLanguageOption2(
     string feature, OptionGroup group, string name, T defaultValue,
     OptionStorageLocation2 storageLocation1, OptionStorageLocation2 storageLocation2)
     : this(feature, group, name, defaultValue, ImmutableArray.Create(storageLocation1, storageLocation2))
 {
 }
예제 #10
0
 internal PerLanguageOption2(string feature, OptionGroup group, string name, T defaultValue)
     : this(feature, group, name, defaultValue, ImmutableArray <OptionStorageLocation2> .Empty)
 {
 }