1) Create class
public class SampleClass
{
public string SampleVarA { get; set; }
public string SampleVarB { get; set; }
public string SampleVarC { get; set; }
}
2) Define contract as below
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/MyWcfMethod")]
string MyWcfMethod(List<SampleClass> myInput);
3) Implement the method as below
public string MyWcfMethod(List<SampleClass> myInput)
{
var result = string.Empty;
foreach (var item in myInput)
{
result += item.SampleVarA;
result += "--";
}
return result;
}
4) U can send the object as json collection from UI