/// <summary> /// Gets the stub header. /// </summary> /// <param name="feature">The feature.</param> /// <param name="count">The count.</param> /// <returns></returns> public static DbaseFileHeader GetHeader(IFeature feature, int count) { IAttributesTable attribs = feature.Attributes; string[] names = attribs.GetNames(); DbaseFileHeader header = new DbaseFileHeader(); header.NumRecords = count; foreach (string name in names) { Type type = attribs.GetType(name); if (type == typeof(double) || type == typeof(float)) { header.AddColumn(name, 'N', DoubleLength, DoubleDecimals); } else if (type == typeof(short) || type == typeof(ushort) || type == typeof(int) || type == typeof(uint)) { header.AddColumn(name, 'N', IntLength, IntDecimals); } else if (type == typeof(long) || type == typeof(ulong)) { header.AddColumn(name, 'N', LongLength, IntDecimals); } else if (type == typeof(string)) { header.AddColumn(name, 'C', StringLength, StringDecimals); } else if (type == typeof(bool)) { header.AddColumn(name, 'L', BoolLength, BoolDecimals); } else if (type == typeof(DateTime)) { header.AddColumn(name, 'D', DateLength, DateDecimals); } else { throw new ArgumentException("Type " + type.Name + " not supported"); } } return(header); }