I have a generic type:
MyType<T1, T2, T3>
and I want to do this:
typeof(MyType<,,>).MakeGenericType(new [] { null, null, string});
so i get:
MyType<,,string>
But you cannot pass null types to MakeGenericType (see: http://msdn.microsoft.com/en-us/library/system.type.makegenerictype.aspx ).
How do I achieve this?
thanks
Ok, I avoided this:
var args = typeof(MyType<,,>).GetGenericArguments(); args[2] = typeof(string); typeof(MyType<,,>).MakeGenericType(args);
Source: https://habr.com/ru/post/1710559/More articles:Stuck with BinaryExpression in C # - c #LDAP AD - range attribute, how to use it? - ldapNHibernate: These classes referenced by "extends" not found - nhibernateSQL 2005 random connection timeouts / best practice regarding db timeouts - c #How to insert a new row using Silverlight 3 DataGrid (and not use DataForm)? - .netHow to stop closing mfc application when pressing ESC key - visual-c ++How can I create an object whose derived class is specified implicitly by the creation properties? - inheritanceReturn class from a nested collection using NHibernate - nhibernateThe difference between Subversion and MKS - svnConverting a MIME Tree to MailMessage - .netAll Articles