Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: User.GetUserFromId

$
0
0
Ok well firstly if your method doesn't return a value it should be set as void eg
  public void GetImageUrl(string providerUserID)
{
    try
    {
        var user = User.GetUserFromId(long.Parse(providerUserID));

        if (user != null)
        {
            return user.ProfileImageUrl;
        }
    }
    catch (Exception ex)
    {
    }
}
}
  1. Is the code to return the providerUserID functioning correctly? (Does it return a valid ID everytime?)
  2. You could also try Convert.ToInt64() instead of long.Parse() - I believe they both return the same though so It may not matter.
  3. The only reason I can think of what with what I've seen of your code is when you refresh the page the variable providerUserID is being unset on refresh.
Edit: Can't get it to format the code correctly but you want to remove "return null;" and replace "public string GetImageUrl(string providerUserID)" with " public void GetImageUrl(string providerUserID)" because you are not returning a string.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>