Reputation: 70337
I need to transmit some binary data, specifically image files, as part of my WCF call. What data type should I use for the WCF contract?
[DataContract]
public class ZombieTypeSUmmary
{
[DataMember]
public string ZombieTypeName { get; set; }
[DataMember]
public int ZombieTypeKey { get; set; }
[DataMember]
public string BriefDescription { get; set; }
[DataMember]
public ??? ThumbnailImage { get; set; }
}
Upvotes: 1
Views: 936
Reputation: 87308
byte[]
is the best choice in most cases. Unless you have very large binary data (which doesn't seem to be your case, since you're talking about thumbnail images), this is what you should use, since it's supported in all serializers.
If you're talking about very large binary data (where you'd want to stream the object, instead of serialize it to a buffer then transmit it), then it's not as simple. There's no direct support for streaming inside data contracts but there are a few things you can use, which I pointed out in the post at http://blogs.msdn.com/b/carlosfigueira/archive/2011/03/25/wcf-streaming-inside-data-contracts.aspx.
Upvotes: 4