I have a WCF webservice that needs to return data in table form, basically just columns and rows of simple text. Right now, I am using a datatable but that is giving me headaches. Would another type such as a 2D array of strings work effectively well, maybe even better? What datatype would be best with the least amount of complications?
views:
71answers:
2When SvcUtil.exe generates a proxy for clients, it generally converts most 2D array of strings into simple string arrays (string[]).
This would simplify the client proxy generation for you.
I would use the list that provided the optimal services for you. For example, if you will be iterating one after the other, a normal array may be fine. If you will need to sort it, perhaps a generic list may be more appropriate.
Since bandwidth seems to be the issue (previous questions etc)...
If the data is simple text strings, then things like GZIP compression may work wonders. I would be very tempted to investigate transforming the DataTable
into something as simple as tsv (or another delimited form), and run it through a GZipStream
(encoding line by line). Then send the resultant binary down the wire either as a Stream
or a byte[]
. And enable MTOM.