private IEnumerable <Type> ProcessClass(Type classType) { if (classType == null) { throw new ArgumentNullException("classType"); } if (!classType.IsClass) { throw new ArgumentException(); } var types = new List <Type>(); var properties = from property in DataContractHelper.GetContractProperties(classType) select property.Value.PropertyType; types.AddRange(properties); var fields = from field in DataContractHelper.GetContractFields(classType) select field.Value.FieldType; types.AddRange(fields); //Handle complex types for (var i = 0; i < types.Count; i++) { var type = types[i]; //Type is an array if (type.IsArray && type.HasElementType) { types[i] = type.GetElementType(); } } return(types); }