AddColumn() public method

Adds a column.
public AddColumn ( string fieldName, Type dataType ) : void
fieldName string A filed name
dataType System.Type A CLR data type
return void
Exemplo n.º 1
0
        /// <summary>
        /// Generates a dBase file header.
        /// </summary>
        /// <param name="dbFields">An array containing the dBase filed descriptors</param>
        /// <param name="count">The record count</param>
        /// <returns>A stub of dBase file header</returns>
        public static DbaseFileHeader GetDbaseHeader(DbaseFieldDescriptor[] dbFields, int count)
        {
            DbaseFileHeader header = new DbaseFileHeader();

            header.NumRecords = count;

            foreach (DbaseFieldDescriptor dbField in dbFields)
            {
                header.AddColumn(dbField.Name, dbField.DbaseType, dbField.DataType, dbField.Length, dbField.DecimalCount);
            }

            return(header);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a stub of dBase file header
        /// </summary>
        /// <param name="feature">The feature</param>
        /// <param name="count">The record count</param>
        /// <param name="attributeNames">A list containing the attribute names</param>
        /// <returns>A stub of dBase file header</returns>
        public static DbaseFileHeader GetDbaseHeader(Feature feature, List <string> attributeNames, int count)
        {
            //string[] names = feature.Layer.FeatureAttributeNames.ToArray();// attribs.GetNames();
            string[]        names  = attributeNames.ToArray();// attribs.GetNames();
            DbaseFileHeader header = new DbaseFileHeader();

            header.NumRecords = count;
            int i = 0;

            foreach (string name in names)
            {
                Type type = feature.Attributes[i].GetType();// attribs.GetType(name);
                header.AddColumn(name, type);
                i++;
            }
            header.Encoding = System.Text.ASCIIEncoding.ASCII;
            return(header);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates a dBase file header.
        /// </summary>
        /// <param name="dbFields">An array containing the dBase filed descriptors</param>
        /// <param name="count">The record count</param>
        /// <returns>A stub of dBase file header</returns>
        public static DbaseFileHeader GetDbaseHeader(DbaseFieldDescriptor[] dbFields, int count)
        {
            DbaseFileHeader header = new DbaseFileHeader();
            header.NumRecords = count;

            foreach (DbaseFieldDescriptor dbField in dbFields)
                header.AddColumn(dbField.Name, dbField.DbaseType, dbField.DataType, dbField.Length, dbField.DecimalCount);

            return header;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets a stub of dBase file header
 /// </summary>
 /// <param name="feature">The feature</param>
 /// <param name="count">The record count</param>
 /// <param name="attributeNames">A list containing the attribute names</param>
 /// <returns>A stub of dBase file header</returns>
 public static DbaseFileHeader GetDbaseHeader(Feature feature, List<string> attributeNames, int count)
 {
     //string[] names = feature.Layer.FeatureAttributeNames.ToArray();// attribs.GetNames();
     string[] names = attributeNames.ToArray();// attribs.GetNames();
     DbaseFileHeader header = new DbaseFileHeader();
     header.NumRecords = count;
     int i = 0;
     foreach (string name in names)
     {
         Type type = feature.Attributes[i].GetType();// attribs.GetType(name);
         header.AddColumn(name, type);
         i++; 
     }
     header.Encoding = System.Text.ASCIIEncoding.ASCII;
     return header;
 }