I am a newbie. Plzz help me at this. In WCF rest application i want the following response
<parameterList>
<parameter>
<Question> Occupation </Question>
<Choice> Student/Others </Choice>
<Choice> Retired/housewife </Choice>
<Choice> Salaried/SelfEmployed </Choice>
<Choice> Doctor/CA/Socially Important Person </Choice>
</parameter>
</parameterList>
I want 4 same "choice" tags with different contents. What i am getting is only the last "choice" tag.
IService.cs
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "/getQuestion")]
[return: MessageParameter(Name = "parameterList")]
List<parameter> getQuestion();
Service.svc.cs
public List<parameter> getQuestion()
{
List<parameter> lstParameter = new List<parameter>();
parameter param = new parameter();
param.Question = " Occupation ";
param.Choice = " Student/Others ";
param.Choice = " Retired/housewife ";
param.Choice = " Salaried/SelfEmployed ";
param.Choice = " Doctor/CA/Socially Important Person ";
lstParameter.Add(param);
return lstParameter;
}
parameter.cs
public class parameter
{
public string Question
{
get{ } set{ }
}
public string Choice
{
get{ } set{ }
}
}