I'm trying to use System.Reflection
to get the same result for a property as with using the metadata
, specifically the IsComplexType
property. The problem that I'm facing is that I couldn't find the logic that MVC Framework uses to determine if a property is complex or not. The only features of a complex type I could find is that it is a class and is not a built in type of the .Net framework. How can I determine if a (property)type is considered as a complex one, without using the ModelMetadata
properties?
Asked
Active
Viewed 272 times
1

Andrei V
- 7,306
- 6
- 44
- 64
1 Answers
2
IsComplexType is implemented in the following way:
!TypeDescriptor.GetConverter(this.ModelType).CanConvertFrom(typeof(string));
All these classes are not specific for MVC and can be used by you. You only need to replace ModelType
with a type you want to test.

Michał Komorowski
- 6,198
- 1
- 20
- 24