1

Closed

Error: implicit operator is not cast.

description

I have following class
 
public struct Money
{
    public Money(decimal amount = 0) : this()
    {
        Value = amount;
        CurrencyCode = CurrencyCode.USD;
    }
 
    public decimal Value { get; set; }
    public CurrencyCode CurrencyCode { get; set; }
 
    // define implicit Money-to-Nullable<double> conversion operator:
    public static implicit operator double?(Money money)
    {
        return Decimal.Zero == money.Value 
            ? null 
            : new double?( Convert.ToDouble(money.Value));
    }
}
 
 
When I try to map it to I getting Specifica cast is not valid exception.
 
Eception Message:
 
Mapping types:
Money -> Nullable1
MSB.Chup.Policy.Model.Primitives.Money -> System.Nullable
1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
 
Destination path:
Building.CurrentCoverage
 
Source value:
MSB.Chup.Policy.Model.Primitives.Money
Closed Sep 28, 2012 at 3:44 PM by jbogard
I can't close the project - can you post this issue on GitHub? I don't track them here.

comments