Ejemplo n.º 1
0
        protected ParameterBase(object?value)
        {
            if (value != null)
            {
                var type = value.GetType();
                if (!CodeGeneratorConfigurationUtility.IsAllowedConstantType(type))
                {
                    throw new ArgumentException($"{type.FullName} is not an allowed type for an attribute parameter.");
                }
            }

            Value = value;
        }
Ejemplo n.º 2
0
        public Constant(string name, object?value)
        {
            if (value != null)
            {
                var type = value.GetType();
                if (!CodeGeneratorConfigurationUtility.IsAllowedConstantType(type))
                {
                    throw new ArgumentException($"{type.FullName} is not an allowed type for a constant in a 'ThisAssembly' class.");
                }
            }

            Name  = name;
            Value = value;
        }