public PropertyDeclaration AddProperty(ITypeDeclaration type, string name)
        {
            if (type==null)
                throw new ArgumentNullException("type");
            if (name==null)
                throw new ArgumentNullException("name");

            PropertyDeclaration p = new PropertyDeclaration(this.Conformer.ToCapitalized(name),this,type);
            this.properties.Add(p);
            return p;
        }
        private void AttachXmlElementAttributes(PropertyDeclaration p, FieldInfo f)
        {
            string customName = null;
            // if array is type add element
            if (f.FieldType.IsArray && f.FieldType.GetElementType()!=typeof(Object))
            {
                AttributeDeclaration attr = p.CustomAttributes.Add(typeof(XmlElementAttribute));
                attr.Arguments.Add("ElementName",Expr.Prim(f.Name));
                //MMI:attr.Arguments.Add("Type",Expr.Prim(MapType(f.FieldType.GetElementType()).Name));
                attr.Arguments.Add("Type",Expr.TypeOf(MapType(f.FieldType.GetElementType())));
                customName = f.Name;
            }

            // attach xml elements
            foreach(XmlElementAttribute el in f.GetCustomAttributes(typeof(XmlElementAttribute),true))
            {
                if (customName == el.ElementName)
                    continue;
                AttributeDeclaration attr = p.CustomAttributes.Add(typeof(XmlElementAttribute));
                attr.Arguments.Add("ElementName",Expr.Prim(el.ElementName));
                if (el.Type!=null)
                {
                    //MMI:attr.Arguments.Add("Type",Expr.Prim(MapType(el.Type).Name));
                    attr.Arguments.Add("Type",Expr.TypeOf(MapType(el.Type)));
                }
            }
        }