c# - Class with [Serializable] attribute refuse to serialize -




i have class decorated [serializable] attribute. creating object of class , adding datatable. when serialize datatable using binaryserializer getting error as

type not implement ixmlserializable interface therefore can not proceed serialization.

here sample code

[serializable] class propertydata {   // properties }  class main {   propertydata obj = new propertydata();    dttable.rows.add(val1,val2,val3, obj);    // ...    objbinaryformatter.serialize(stream, dttable); // throws exception  } 

please suggest solution.

binaryformatter expects [serializable] attribute alright, exception not seem come binaryformatter, xmlserializer. problem seems class not public. however, code not clear, seem serializing datatable. try store datatable inside dataset , instead serialize that.

for quick reference, please checkout .net serializers





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -