Declaring a decimal typed argument to an attribute constructor in VS 2017 will produce CS0181.
Providing a decimal typed argument to an attribute constructor that takes say object in VS 2017 will produce CS0182.
In both cases, building from the command line will work.
using System;
class DecimalAttribute : Attribute
{
public DecimalAttribute(decimal value) { }
}
class AnyAttribute : Attribute
{
public AnyAttribute(object value) { }
}
class Program
{
// 1>Program.cs(14,3,14,5): error CS0181: Attribute constructor parameter 'value' has type 'decimal', which is not a valid attribute parameter type
[Decimal(123m)] public int CS0181 { get; set; }
// 1>Program.cs(15,7,15,11): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
[Any(123m)] public int CS0182 { get; set; }
}
Declaring a
decimal
typed argument to an attribute constructor in VS 2017 will produce CS0181. Providing adecimal
typed argument to an attribute constructor that takes sayobject
in VS 2017 will produce CS0182.In both cases, building from the command line will work.