Esempio n. 1
0
        public string Generate(object parameters)
        {
            IPropertyLookup properties    = PropertyLookup.CreatePropertyLookup(parameters);
            var             substitutions = from variable in Variables
                                            let property = properties.GetProperty(variable.Name)
                                                           where property != null
                                                           from value in getSubstitutions(variable, property)
                                                           select qualify(variable, value);

            var result = Prefix + String.Join(Separator, substitutions);

            return(result);
        }
        internal static NameValueCollection CreateNameValueCollection(object instance)
        {
            NameValueCollection collection = new NameValueCollection();
            IPropertyLookup     lookup     = PropertyLookup.CreatePropertyLookup(instance);

            foreach (IProperty property in lookup.GetProperties())
            {
                var values = PropertyLookup.GetValues(property, false)
                             .Where(v => !(v is Tuple <string, object>));
                foreach (object value in values)
                {
                    collection.Add(property.Name, escape(value));
                }
            }
            return(collection);
        }