wiz0u / WTelegramClient

Telegram Client API (MTProto) library written 100% in C# and .NET
https://wiz0u.github.io/WTelegramClient/
MIT License
956 stars 156 forks source link

Some properties are only private #252

Closed GeorgiyGit closed 4 months ago

GeorgiyGit commented 4 months ago

Some of the properties (for example MessageBase.messages) are private (without any public instances). And there is no normal way to get them

wiz0u commented 4 months ago

I think you're confusing things. They are not private, they are in derived classes.

As explained in the important ReadMe (make sure you read it):

When querying the Telegram Client API, you will often obtain base class objects (classname sometimes ending with Base), providing only access to a few generic properties. If you want to access all of the object fields, you need to check and cast that object into its precise subclass (derived class). This is usually achieved using C# operators like is Subclass sc, as Subclass or case Subclass sc ; after which you can manipulate all those fields in variable sc.

To learn which subclasses are available for a base class, press F12 or hover your mouse on the classname to display the Intellisense tooltip, the description text lists all subclasses. Also, learn to use the debugger and check the last column from the Watch pane for the actual type of an object in your variables/fields.