Re: xml serialization of List<byte>



If you want an array of bytes serialized as Base64, use an array, not a
List.

--
HTH,

Kevin Spencer
Microsoft MVP
Short Order Coder
http://unclechutney.blogspot.com

The devil is in the yada yada yada


<lee.crabtree@xxxxxxxxx> wrote in message
news:1162413539.934521.278220@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm trying to serialize a generic List of bytes, as in List<byte>. Out
of the box, it works, but it winds up like this:

...
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>0</LineData>
<LineData>255</LineData>
<LineData>255</LineData>
<LineData>255</LineData>
<LineData>255</LineData>
<LineData>255</LineData>
<LineData>255</LineData>
...

The data is right, but have each byte in a tag is just asinine. It
would make a whole lot more sense to have it serialized as "hexBinary"
or "base64Binary", but adding those attributes throw an error saying
that there was an exception reflecting the type containing the List.

What am I doing wrong?

Lee Crabtree



.



Relevant Pages

  • Re: Encrypted email - is there a specific solution?
    ... assign the byte array to the mailmsg body please? ... >, then you can encrypt ... > the data and either send it to yourself as an attachment or base64 encode it ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: displaying binary images
    ... It is a base64 byte array of the format of a png file. ... disk as a png file with that extension, it opens fine in the browser. ...
    (comp.lang.javascript)
  • Re: Base64 strange problem
    ... base64 decoder in the servlet to decode it. ... the decoded byte array is shorter then the original one. ...
    (comp.lang.javascript)
  • Re: Are constants not locally static?
    ... array length of the value it's allowed (but not compliant, ... yada yada ... ... So onto the code that caused the warning. ... The package is ...
    (comp.lang.vhdl)
  • Re: displaying binary images
    ... > where png is the variable that contains a base64 binary array representation ... you need a base64 string. ... > the png file that was returned from the server. ...
    (comp.lang.javascript)