Sunday, January 29, 2017

.NET JsonContent for HttpClient

.NET already comes with a nice collection of HttpContent serializers, but it lacks a JsonContent type. A common solution is to just serialize their payload to a JSON string and that insert that into an instance of StringContent. However, this means that you need to remember to set your headers, and it is a little bit inefficient because of how it creates multiple strings and buffers for each payload.

I have create a simple implementation of JsonContent that uses Json.NET and pooled memory streams. The result is between 2% and 10% faster, and causes ~50% fewer garbage collections.

Check out the implementation in Tact.NET:

Enjoy,
Tom

5 comments:

  1. You can look for a YouTube promotion for your videos but to get more people to this post I would suggest to buy instagram followers

    ReplyDelete
  2. You can always get a Twitter Promotion but most people now buy instagram likes for your uploaded photos.

    ReplyDelete
  3. It is helpful for me. It is informative. I think you are the best blogger. so thanks for sharing the informative article. World wide Marketing Agency

    Driver Booster Pro Crack

    Pilotedit Crack

    Download Cracks for PCs

    IDM Crack

    Tomabo MP4 Downloader Pro Crack

    World of Cracks

    ReplyDelete
  4. I'm impressed, I must say. Actually rarely can i encounter a blog that's both educative and entertaining, and without a doubt, you could have hit the nail about the head. Your idea is outstanding; the thing is something that too few individuals are speaking intelligently about. We are delighted that we came across this around my try to find some thing with this.토토사이트

    ReplyDelete

Real Time Web Analytics