Hi,
I have a class and a WebMethod in my C# Web Service Project like this:
public class Results
{
public int result1;
public int result2;
public string str1;
}
[WebMethod]
public Results getResults(int value1, int value2)
{
Results results = new Results();
results.result1 = value1 + value2;
if (value1 > value2)
{
results.result2 = value1 - value2;
results.str1 = "ok";
}
return results;
}
When I give values; value1:5 value2:3 then this XML created:
<Results>
<result1>8</result1>
<result2>2</result2>
<str1>ok</str1>
</Results>
And when I give values; value1:5 value2:8 then this XML created:
<Results>
<result1>13</result1>
<result2>0</result2>
</Results>
result2 tag returns 0 value and str1 tag is not visible. C# automaticly creates tag with value of 0 for integers, and no tags for null strings.
How can I get a response like this????:
<Results>
<result1>13</result1>
<result2></result2>
<str1></str1>
</Results>
I want to create all tags with values. If value is null, can i create null tag?
(<str1></str1> or <str1/>)
Thanks.