[mono-android] Problem with reflection and nullables

Goncalo Oliveira goncalo at minkan.net
Tue Jun 5 08:40:37 UTC 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120605/6c4cc5df/attachment.html>


More information about the Monodroid mailing list