RedditSharp-DEPRECATED-
RedditSharp-DEPRECATED- copied to clipboard
Unable to get authornames of child comments replying to my comments, or authornames of the comments/posts I've replied to
The code I have attempted with isn't quite getting me there - just wanting to know if I'm making a mistake, or if this isn't currently supported. I also keep getting the following exception System.InvalidOperationException: Enumerator is in an invalid state
;
var myComments = reddit.User.GetComments(7).Where(i => i.More.Children.Any() || i.Parent != null);
myComments.ForEach(comment =>
{
foreach (var property in comment.More.Children)
{
Console.WriteLine(property);
}
});
myComments.ForEach(comments =>
{
foreach (var comment in comments.Comments)
{
Console.WriteLine(comment.AuthorName);
}
});
I can't grab any properties relating to children author names off of property
or comment
. I've tried a couple different ways, but I was able to do this with people who replied to my posts - just not those who have replied to my comments.
Any insight is welcome, thanks!
What version are you using? And what exactly is throwing that exception. Nothing's catching my eye that's wrong.
What version are you using? And what exactly is throwing that exception. Nothing's catching my eye that's wrong.
The line throwing that exception is:
var myComments = reddit.User.GetComments(7).Where(i => i.More.Children.Any() || i.Parent != null);
I just now determined that the version I've been using was 1.0.0, which seems suspect given that you asked which version.
I also see 1.0.4 available, which I just installed - as well as a 2.0.0 from which I think is not your library:
I'm using Rider, but I can't imagine that matters at all.
That 2.0 version looks correct, I haven't done nuget in VSCode (at least that what your IDE looks like). Try using that instead first. I need to just push it to a non pre-release state and get over it >.<