joshcomley / sendgrid-netcore Goto Github PK
View Code? Open in Web Editor NEW.Net Core port of SendGrid-sharp
.Net Core port of SendGrid-sharp
I have user without core version of library. In my case I am using the template and my parameter dynamically send from my code. When I have used this utility found bug while Serialize the object. Below is the method is used in code
`using (var jsonWriter = new JsonTextWriter(writer))
{
serializer.Serialize(jsonWriter, objectToSerialize);
return jsonWriter.ToString();
//Console.WriteLine(writer.ToString());
}`
This method not created json string properly. So I have change the code as below.
`using (var jsonWriter = new JsonTextWriter(writer))
{
//serializer.Serialize(jsonWriter, objectToSerialize);
//return jsonWriter.ToString();
return JsonConvert.SerializeObject(objectToSerialize).ToString();
//Console.WriteLine(writer.ToString());
}`
After that all is working fine. It will help some who uses the templates. Please comment is there any better option available that this.
public static string Serialize<T>(T objectToSerialize)
{
if (objectToSerialize == null)
throw new ArgumentNullException("A key or value in your X-SMTPAPI header is null.");
var serializer = JsonSerializer.Create();
using (var writer = new StringWriter())
{
using (var jsonWriter = new JsonTextWriter(writer))
{
serializer.Serialize(jsonWriter, objectToSerialize);
// return jsonWriter.ToString();
return writer.ToString();
}
}
}
Unfortunately, this library is not compatible with the just released version of aspnet core 1.1.0 because of the referenced Microsoft.AspNet.WebApi.Client 5.2.3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.