-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
Description
.NET Framework 4.5.2
DelegateDecompiler 0.21.0
enum PayGrade : byte
{
Low,
High
}
class Employee
{
public PayGrade PayGrade { get; set; }
[Computed]
public decimal Salary
{
get
{
if (PayGrade == PayGrade.High)
{
return 1000M;
}
return 10M;
}
}
}
class Program
{
static void Main(string[] args)
{
var employees = new[]
{
new Employee { PayGrade = PayGrade.Low },
new Employee { PayGrade = PayGrade.High },
}
.AsQueryable();
var salaries = (from employee in employees
select employee.Salary)
.Decompile()
.ToList();
}
}
The code above throws an InvalidOperationException with the following message:
"The binary operator Equal is not defined for the types 'System.Byte' and 'System.Int32'."
Changing the PayGrade enum's underlying type to int prevents the exception.