RedditSharp-DEPRECATED- icon indicating copy to clipboard operation
RedditSharp-DEPRECATED- copied to clipboard

Change anything requiring additional web requests to be a method instead of a property

Open CrustyJew opened this issue 8 years ago • 5 comments

Historically things have been pulled via Properties on an object like Subreddit.Moderators. Changing everything over to async, this doesn't always work the best as it can't actually call an async method in the getter of a property. You can get around this by calling Task.Run(), but you lose performance benefits from async if I am understanding everything correctly.

Thoughts on how this should be designed going forward? 2.0 is going to break enough stuff that we can safely redesign it however we want most likely.

CrustyJew avatar Dec 19 '16 19:12 CrustyJew

properties on objects that are filled at the creation of the object are fine, but otherwise it just looks nicer in the code as a property, but having a method to retrieve it asyncronously if wanted could be done just fine

chuggafan avatar Dec 19 '16 21:12 chuggafan

I'm leaning towards anything that comes as data with the actual json should be a property. Anything that fires an additional web request should be a method.

CrustyJew avatar Dec 20 '16 04:12 CrustyJew

I like that idea.

Properties shouldn't be that complex anyway.

pimanac avatar Dec 23 '16 01:12 pimanac

Is this what we've decided on, then? Properties requiring another web call are getting moved to Methods?

pimanac avatar Jan 18 '17 23:01 pimanac

Yes i think that's the best way to handle it

On Jan 18, 2017 5:14 PM, "Andrew" [email protected] wrote:

Is this what we've decided on, then? Properties requiring another web call are getting moved to Methods?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CrustyJew/RedditSharp/issues/40#issuecomment-273632596, or mute the thread https://github.com/notifications/unsubscribe-auth/AHDuEN5m1zcah00y3nS-U7pRDgKqN6UFks5rTpzwgaJpZM4LREtk .

CrustyJew avatar Jan 20 '17 04:01 CrustyJew