diff options
author | Maxim Dubrovkin <maximdubrovkin@Maxims-MBP.Dlink> | 2016-09-20 21:45:00 +0500 |
---|---|---|
committer | Maxim Dubrovkin <maximdubrovkin@Maxims-MBP.Dlink> | 2016-09-20 21:45:00 +0500 |
commit | 7e64f663328ad676ac1b14dbd21d7e53688f28cb (patch) | |
tree | f9f1473705f80f30b52bf4fd1d6c6c583e22f3db | |
parent | 63d24c1ec5b7a03e067c190b3d3021a62b2a7f78 (diff) | |
download | sendgrid-csharp-7e64f663328ad676ac1b14dbd21d7e53688f28cb.zip sendgrid-csharp-7e64f663328ad676ac1b14dbd21d7e53688f28cb.tar.gz sendgrid-csharp-7e64f663328ad676ac1b14dbd21d7e53688f28cb.tar.bz2 |
Revert back pre initialize auto-properties.
-rw-r--r-- | SendGrid/SendGrid/Helpers/Mail/Personalization.cs | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/SendGrid/SendGrid/Helpers/Mail/Personalization.cs b/SendGrid/SendGrid/Helpers/Mail/Personalization.cs index fbab22d..21e9c76 100644 --- a/SendGrid/SendGrid/Helpers/Mail/Personalization.cs +++ b/SendGrid/SendGrid/Helpers/Mail/Personalization.cs @@ -6,56 +6,74 @@ namespace SendGrid.Helpers.Mail public class Personalization
{
[JsonProperty(PropertyName = "to")]
- public List<Email> Tos { get; set; } = new List<Email>();
+ public List<Email> Tos { get; set; }
[JsonProperty(PropertyName = "cc")]
- public List<Email> Ccs { get; set; } = new List<Email>();
+ public List<Email> Ccs { get; set; }
[JsonProperty(PropertyName = "bcc")]
- public List<Email> Bccs { get; set; } = new List<Email>();
+ public List<Email> Bccs { get; set; }
[JsonProperty(PropertyName = "subject")]
public string Subject { get; set; }
[JsonProperty(PropertyName = "headers")]
- public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
+ public Dictionary<string, string> Headers { get; set; }
[JsonProperty(PropertyName = "substitutions")]
- public Dictionary<string, string> Substitutions { get; set; } = new Dictionary<string, string>();
+ public Dictionary<string, string> Substitutions { get; set; }
[JsonProperty(PropertyName = "custom_args")]
- public Dictionary<string, string> CustomArgs { get; set; } = new Dictionary<string, string>();
+ public Dictionary<string, string> CustomArgs { get; set; }
[JsonProperty(PropertyName = "send_at")]
public long SendAt { get; set; }
public void AddTo(Email email)
{
+ if (Tos == null)
+ Tos = new List<Email>();
+
Tos.Add(email);
}
public void AddCc(Email email)
{
+ if (Ccs == null)
+ Ccs = new List<Email>();
+
Ccs.Add(email);
}
public void AddBcc(Email email)
{
+ if (Bccs == null)
+ Bccs = new List<Email>();
+
Bccs.Add(email);
}
public void AddHeader(string key, string value)
{
+ if (Headers == null)
+ Headers = new Dictionary<string, string>();
+
Headers.Add(key, value);
}
public void AddSubstitution(string key, string value)
{
+ if (Substitutions == null)
+ Substitutions = new Dictionary<string, string>();
+
Substitutions.Add(key, value);
}
public void AddCustomArgs(string key, string value)
{
+ if (CustomArgs == null)
+ CustomArgs = new Dictionary<string, string>();
+
CustomArgs.Add(key, value);
}
}
|