Created
July 20, 2011 21:49
-
-
Save clausjoergensen/1096008 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace RestSharp.Deserializers | |
{ | |
public class XmlDeserializer : IDeserializer | |
{ | |
... | |
private void Map(object x, XElement root) | |
{ | |
... | |
else if (type.IsGenericType) | |
{ | |
var t = type.GetGenericArguments()[0]; | |
var list = (IList)Activator.CreateInstance(type); | |
// is 'root' meant to be the content of the ENTIRE xml document? | |
var container = GetElementByName(root, prop.Name.AsNamespaced(Namespace)); | |
var first = container.Elements().FirstOrDefault(); | |
var elements = container.Elements(first.Name); | |
PopulateListFromElements(t, elements, list); | |
prop.SetValue(x, list, null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment