Compare Two NameValueCollections Extension Method
Posted
by Jon Canning
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Jon Canning
Published on Thu, 16 Jun 2011 20:57:50 GMT
Indexed on
2011/06/20
16:24 UTC
Read the original article
Hit count: 296
Filed under:
public static class NameValueCollectionExtension { public static bool CollectionEquals(this NameValueCollection nameValueCollection1, NameValueCollection nameValueCollection2) { return nameValueCollection1.ToKeyValue().SequenceEqual(nameValueCollection2.ToKeyValue()); } private static IEnumerable<object> ToKeyValue(this NameValueCollection nameValueCollection) { return nameValueCollection.AllKeys.OrderBy(x => x).Select(x => new {Key = x, Value = nameValueCollection[x]}); } }
© Geeks with Blogs or respective owner