I am working with below mentioned structure where i have classes in that i have list of classes with a class name. Each class has its mapping.
I need to query this using rest sharp from a rest service.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response status="Success">
<Classes>
<Class className="Library">
<ClassMappings>
< ClassMapping key="cls1" />
< ClassMapping key="cls2" />
< ClassMapping key="cls3" />
</ ClassMappings>
</ Class>
< Class className="Staff">
</ Class>
.
.
.
</Classes>
I have designed this classes but its not giving me mappings properly.
public class Class
{
public string className { get; set; }
//public ClassMappings Mappings { get; set; }
public List<ClassMapping> Mappings { get; set; }
}
public class Classes : List<Class> { }
//public class ClassMappings //: List<ClassMapping>
//{
// public List<ClassMapping> ClassMapping { get; set; }
//}
public class ClassMapping
{
public string key { get; set; }
}
You can see i have already tried the commented code also. Where class mappings is a different class.
Can anyone help me designing classes for rest call.
Thanks
The array should be named
ClassMappingsinstead ofMappings.As a general solution you could load the xml as a generic object and then use the debugger to see the correct structure.