Esempio n. 1
0
        protected ValueInfo(
            string name, DisplayText description, MSBuildValueKind valueKind = MSBuildValueKind.Unknown,
            CustomTypeInfo customType = null, string defaultValue = null, bool isDeprecated = false, string deprecationMessage = null)
            : base(name, description)
        {
            if (valueKind.IsCustomType() && customType == null)
            {
                throw new ArgumentException($"When {nameof(valueKind)} is {nameof(MSBuildValueKind.CustomType)}, {nameof (customType)} cannot be null");
            }

            if (customType != null && !valueKind.IsCustomType())
            {
                throw new ArgumentException($"When {nameof(customType)} is provided, {nameof(valueKind)} must be {nameof(MSBuildValueKind.CustomType)}");
            }

            CustomType         = customType;
            DefaultValue       = defaultValue;
            IsDeprecated       = isDeprecated || !string.IsNullOrEmpty(deprecationMessage);
            DeprecationMessage = deprecationMessage;
            ValueKind          = valueKind;
        }