You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I want to get click event information. Some click event contains urloffset, some is not. (Ex : https://github.com/mirajavora/sendgrid-webhooks/blob/master/Sendgrid.Webhooks.Tests/Events/click.json )
When event doesn't contain UrlOffset, i'm getting ' Object reference not set to an instance of an object' error. int clickIndex = clickEvent.UrlOffset.Index; string clickType = clickEvent.UrlOffset.Type;
How can i use Contains() method ?
Like following : if (clickEvent.Contains("UrlOffset")) { }
Thanks.
The text was updated successfully, but these errors were encountered:
To ensure that you do not get null references, you need to include a null check in a ClickEvent constructor
public class ClickEvent : EngagementEventBase
{
public ClickEvent()
{
if (this.UrlOffset == null)
this.UrlOffset = new UrlOffset();
}
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("url_offset")]
public UrlOffset UrlOffset { get; set; }
}
Hi,
I want to get click event information. Some click event contains urloffset, some is not. (Ex : https://github.com/mirajavora/sendgrid-webhooks/blob/master/Sendgrid.Webhooks.Tests/Events/click.json )
When event doesn't contain UrlOffset, i'm getting ' Object reference not set to an instance of an object' error.
int clickIndex = clickEvent.UrlOffset.Index; string clickType = clickEvent.UrlOffset.Type;
How can i use Contains() method ?
Like following :
if (clickEvent.Contains("UrlOffset")) { }
Thanks.
The text was updated successfully, but these errors were encountered: