Get the container type for a nested type using reflection

You can get this by retrieving the property “DeclaringType”.

Quoting MSDN:

A Type object representing the enclosing type, if the current type is a nested type; or the generic type definition, if the current type is a type parameter of a generic type; or the type that declares the generic method, if the current type is a type parameter of a generic method; otherwise, null.

http://msdn.microsoft.com/en-us/library/system.type.declaringtype.aspx

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)