void BindByName (ref int src, StringBuilder sb, ReadOnlyCollection<string> names, NameValueCollection nvc, IDictionary<string,string> dic, bool omitDefaults, bool query)
{
foreach (string name in names) {
int s = template.IndexOf ('{', src);
int e = template.IndexOf ('}', s + 1);
#if NET_2_1
string value = null;
#else
string value = nvc != null ? nvc [name] : null;
#endif
if (dic != null)
dic.TryGetValue (name, out value);
if (query) {
if (value != null || (!omitDefaults && Defaults.TryGetValue (name, out value))) {
sb.Append (template.Substring (src, s - src));
sb.Append (value);
}
} else
if (value == null && (omitDefaults || !Defaults.TryGetValue(name, out value)))
throw new ArgumentException(string.Format("The argument name value collection does not contain non-nul vaalue for '{0}'", name), "parameters");
else {
sb.Append (template.Substring (src, s - src));
sb.Append (value);
}
src = e + 1;
}
}