Mono.Util.MonoXSD.PopulateSequence C# (CSharp) Méthode

PopulateSequence() public méthode

public PopulateSequence ( FieldInfo fields, PropertyInfo properties ) : XmlSchemaSequence
fields System.Reflection.FieldInfo
properties System.Reflection.PropertyInfo
Résultat System.Xml.Schema.XmlSchemaSequence
                public XmlSchemaSequence PopulateSequence (FieldInfo [] fields, PropertyInfo [] properties)
                {
                        if (fields.Length == 0 && properties.Length == 0)
                                return null;

                        XmlSchemaSequence sequence = new XmlSchemaSequence ();

                        try {
                                foreach (FieldInfo field in fields)
                                        if (IsXmlAttribute (field))
                                                attributes.Add (field, field.FieldType);
                                        else if (IsXmlAnyAttribute (field))
                                                attributes.Add (field,
                                                        typeof (System.Xml.Schema.XmlSchemaAnyAttribute));
                                        else
                                                AddElement (sequence, field, field.FieldType);

                        } catch (Exception e) {
                                throw e;
                        }

                        if (properties.Length == 0)
                                return sequence;
                        try {
                                foreach (PropertyInfo property in properties)
                                        if (IsXmlAttribute (property))
                                                attributes.Add (property, property.PropertyType);
                                        else if (IsXmlAnyAttribute (property))
                                                attributes.Add (property,
                                                        typeof (System.Xml.Schema.XmlSchemaAnyAttribute));
                                        else {
                                                AddElement (sequence, property, property.PropertyType);
                                        }

                        } catch (ArgumentException e) {
                                throw e;
                        }

                        return sequence;
                }