I have a custom type with a nullable property that I am trying to project into from a nullable column in SQL. I am always getting a 'missingmethodexception' like so:
{"Method not found: 'Void MyType.set_Number(System.Nullable`1<Int32>)'."}
Is there a problem with trying to project into a custom type with nullable automatic properties? The code looks like this:
public class MyType {
public string Name {get;set;}
public decimal Value { get; set;}
public int? Number { get; set;}
}
Dictionary<int, CustomType> dict;
dict = (from t in table
select new {
id = av.Account.Id,
mt = new MyType { Name = t.Name, Value = t.Value, Number = t.Number }
}).ToDictionary(item => item.id, item => item.mt);