Great, that was what I had in mind.

For the sake of completeness: The TMemoryBuffer class implements De/Serialize() methods, but it has the big drawback that everything is hardcoded to binary protocol. So if anybody wants to improve that piece ... I have to admit that I never used TMemoryBuffer, the stream solution looks much more flexible to me. I usually add some fabric methods somewhere in my code wich create the transport/protocol stacks I need for that project, including the ones used solely for de/serialization.

Have fun,
JensG





-----Ursprüngliche Nachricht----- From: Joseph Fradley
Sent: Tuesday, June 3, 2014 1:38 PM
To: [email protected]
Subject: Re: Can't find C# TSerializer

thanks, I ended up doing something like this:

           using (MemoryStream ms = new MemoryStream())
           {
               FlexBC.Write(new TJSONProtocol(new TStreamTransport(ms,
ms)));
               ms.Seek(0, SeekOrigin.Begin);
               StreamReader sr = new StreamReader(ms);
               string jsonTxt = sr.ReadToEnd();
               Console.WriteLine(jsonTxt);
           }


On Tue, Jun 3, 2014 at 7:28 AM, Jens Geyer <[email protected]> wrote:

If there is none, you can easily build one. Just use a stream transport
and extract the data from the stream. Opposite way works similar. Does that
do the trick for you?

Have fun,
JensG
________________________________
Von: Joseph Fradley
Gesendet: 03.06.2014 13:14
An: [email protected]
Betreff: Can't find C# TSerializer

Hello,

I'm trying to write out my object into JSON using C#/Thrift. But I can't
seem to find TSerializer. I have the Thrift C# library version 0.9.1.3
downloaded from NuGet in VS 2013. I've checked the DLL and can't locate it
in any of the namespaces. I believe it's supposed to be in the root
'Thrift' namespace.

Could it be that this was somehow not included in the NuGet package?

Joe


Reply via email to