Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

08 Null Handling

Henrik Fröhling edited this page Dec 1, 2016 · 2 revisions

The Trakt API might not return all data, especially not when you are using the extended info. Therefore, you should check object properties, if they are null or not.

var user = client.Users.GetUserProfileAsync("username");
var userAvatarUrl = user.Images?.Avatar?.Full;  // will be null

// with images

var user = client.Users.GetUserProfileAsync("username", new TraktExtendedInfo { Images = true });
var userAvatarUrl = user.Images?.Avatar?.Full;  // could be null