/// <summary> /// The process class. /// </summary> /// <param name="classType"> /// The class type. /// </param> /// <returns> /// The <see cref="IEnumerable"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// </exception> /// <exception cref="ArgumentException"> /// </exception> private static IEnumerable <Type> ProcessClass(Type classType) { if (classType == null) { throw new ArgumentNullException("classType"); } if (!classType.IsClass) { throw new ArgumentException(string.Format("Type '{0}' is not class.", classType), "classType"); } IEnumerable <Type> properties = from property in DataContractHelper.GetContractProperties(classType) select property.Value.PropertyType; var types = properties.ToList(); // Handle complex types for (int i = 0; i < types.Count; i++) { Type type = types[i]; // Type is an array if (type.IsArray && type.HasElementType) { types[i] = type.GetElementType(); } } return(types); }
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); }