strange logic in IndexFieldAttribute

Jan 7, 2010 at 8:23 AM

if (xnlvalues.Count == 1)   //single value
            {
                XmlNode xnodevalue = xnlvalues[0];
                this.PropertyInfo.SetValue(searchRecord, Convert.ChangeType(xnodevalue.InnerText, this.PropertyInfo.PropertyType) , null);
            }
            else if (xnlvalues.Count > 1)   //array
            {
                Type basetype = this.PropertyInfo.PropertyType.GetElementType();
                Array valueArray = Array.CreateInstance(basetype, xnlvalues.Count);
                for (int i = 0; i < xnlvalues.Count; i++)
                {
                    valueArray.SetValue(Convert.ChangeType(xnlvalues[i].InnerText, basetype), i);
                }
                this.PropertyInfo.SetValue(searchRecord, valueArray, null);
            }

 

wondering if I'm understanding wrong, or if in result array has one value, it will be treated as not array, even if property type is array?