c# - Making a non-serializable vendor class serializable -


i using class vendor's dll not xml serializable because 1 of class members interface.

however, need serialize instance of class.

how can tell xmlserializer ignore interface , serialize else?

you can 2 things:

1) create class every thing want, populate vendor class, serialize it.

check adapter design pattern

2) use json.net. once need serialize ipagedlist have metadata , did this:

    public static string serializepagedlist(ipagedlist<t> pagedlist)     {         string result = jsonconvert.serializeobject(            // new anonymous class wanted             new             {                 items = pagedlist,                 metadata = pagedlist.getmetadata()             },             new jsonserializersettings             {                 nullvaluehandling = nullvaluehandling.ignore,                 referenceloophandling = referenceloophandling.ignore             });         return result;     } 

i hope helps.


Comments

  1. Harrah's Cherokee Casino & Hotel - MapyRO
    Harrah's Cherokee Casino & 논산 출장샵 Hotel is 양산 출장마사지 Cherokee, North Carolina's North Carolina's closest casino 광주 출장샵 and gambling 구리 출장안마 capital of the Southeast.Renovated in 2019, Harrah's Cherokee Casino & Hotel is an 군포 출장안마 Indian casino and

    ReplyDelete

Post a Comment

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -