I have a custom wrapper object for my properties: MyType<t>
.
I have private members of these types and public members of type t.
I'm trying to load the object and am getting a cast error:
Unable to cast object of type 'System.String' to type 'Model.MyType`1[System.String]
I have a method for the following:
private t _value;
public static implicit operator t(MyType<t> obj)
{
return obj._value;
}
Any help in what I'm missing to make the cast work would be great.
Update:
The member looks like the following:
MyType<string> PostalCode = new MyType<string>();
I'm loading the properties with Dapper and the methods that were suggested are not being hit. So when the reflection engine tries to load the objects the implicit cast is not firing.