Beispiel #1
0
        public ScriptHeader[] GetHeaders()
        {
            if (items.Count > 0 && (headers == null || headers.Count == 0))
            {
                headers = new List <ScriptHeader>();
                var keys = items[0].Keys;
                foreach (string k in keys)
                {
                    ScriptHeader h;
                    object       val = items[0][k];

                    if (val == null)
                    {
                        h = new ScriptHeader()
                        {
                            FieldName = k, DisplayText = k, Type = typeof(object)
                        }
                    }
                    ;
                    else
                    {
                        h = new ScriptHeader()
                        {
                            FieldName = k, DisplayText = k, Type = items[0][k].GetType()
                        }
                    };

                    headers.Add(h);
                }
            }
            return(headers.ToArray());
        }
Beispiel #2
0
 public void AddHeader(ScriptHeader header)
 {
     if (headers.FirstOrDefault(x => x.FieldName == header.FieldName) == null)
     {
         headers.Add(header);
     }
 }