[mono-android] Problem with reflection and nullables

Goncalo Oliveira goncalo at minkan.net
Tue Jun 5 09:59:13 UTC 2012


Nevermind, it is working correctly. The quick inspector isn't showing the
correct value, but if I add something like "DateTime? j = p.Timmy" it is
correct.


On 5 June 2012 09:40, Goncalo Oliveira <goncalo at minkan.net> wrote:

> Hi,
>
>
> There seems to be an issue with reflection when setting a nullable generic
> property value.
>
>     public class DummyJoe
>     {
>         public DateTime? Timmy
>         {
>             get;
>             set;
>         }
>     }
>
>             DummyJoe p = new DummyJoe();
>             Type type = p.GetType();
>
>             PropertyInfo propertyInfo = type.GetProperty( "Timmy" );
>
>             propertyInfo.SetValue( p, DateTime.UtcNow, null );
>
>
> the code above should set Timmy's value even though it's a nullable.
>
>
>
> --
> Gonçalo Oliveira
>



-- 
Gonçalo Oliveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120605/3d1571b7/attachment.html>


More information about the Monodroid mailing list