I have a WCF service with this contract and implementation:
[OperationContract]
IEnumerable<string> GetData(int value);
public IEnumerable<string> GetData(int value)
{
int i = 0;
while (i++ < value)
{
Console.WriteLine($"returning {i}th item");
yield return $" Item:{i}";
}
}
}
When GetData is called by client the yield does not seem to work. All the items are returned in one go instead of one by one.