Creating a nullable type using Activator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am trying to create an instance of a nullable type using System.Activator
for example

t is passed in from the caller and is the Type info for a nullable type or
can be a standard type i.e string, int etc.

object value = Activator.CreateInstance(t);

value always returns null
 
value always returns null

That makes sense since you haven't specified a value for the instance.


Mattias
 
Hi Giuseppe,

Thanks for the reply, this has helped me solve the problem. Thanks for your
help.
 
Back
Top