What do you want to save?
Add Code snippet
New code examples
-
C# 2021-10-30 07:19:08
c# httpclient postasync stringcontent
private static async Task PostBasicAsync(object content, CancellationToken cancellationToken) { using (var client = new HttpClient()) using (var request = new HttpRequestMessage(HttpMethod.Post, Url)) { var json = JsonConvert.Serialize... Add solution -
C# 2021-10-30 05:17:09
c# object to json online converter
//Make use of the third party library called Newton soft. //To serialize a JSON object to C# class. The below will help. //Note: The C# class and JSON Object should have the same structure public static T Deserialize(string serializedData) {... Add solution -
C# 2021-10-28 04:35:14
use newtonsoft json to clone object
// using Newtonsoft.Json; // This sample is from the StackOverflow response (source cited) with // a couple of modifications public static T Clone<T>(T source) { var jsonSettings = new Newtonsoft.Json.JsonSerializerSettings() { // Use this ... Add solution -
Other 2021-10-19 09:29:10
the request entity's media type 'text/plain' is not supported for this resource
var json = JsonConvert.SerializeObject(body); var content = new StringContent(json); content.Headers.ContentType= new MediaTypeHeaderValue("application/json"); return _client.PostAsync(requestUri, content); https://bartwullems.blogspot.com/2018... Add solution -
Javascript 2021-10-06 14:14:06
c# newtonsoft serialize dictionary to json
Dictionary<string, int> points = new Dictionary<string, int> { { "James", 9001 }, { "Jo", 3474 }, { "Jess", 11926 } }; string json = JsonConvert.SerializeObject(points, Formatting.Indented); Console.... Add solution -
C# 2021-10-05 12:39:05
JavaScriptSerializer() and convert to base64
class Program { static void Main(string[] args) { var account = new ExternalAccount() { Name = "Someone" }; string json = JsonConvert.SerializeObject(account); string base64EncodedExternalAccount = Convert.ToBase6... Add solution -
C# 2021-09-30 08:31:03
authenticatecoreasync owin not hadling exception handlers
using AppFunc = Func<IDictionary<string, object>, Task>; public class OwinExceptionHandlerMiddleware { private readonly AppFunc _next; public OwinExceptionHandlerMiddleware(AppFunc next) { if (next == null) { ... Add solution