From your documentation
Retrieve the Current User
Once you have an authenticated user, you can retrieve the User object with the App.CurrentUser property.
Your class reference says the same thing : https://docs.mongodb.com/realm-sdks/dotnet/latest/reference/Realms.Sync.App.html#Realms_Sync_App_CurrentUser
But there’s no CurrentUser property there. What’s the correct way to get CurrentUser?
nirinchev
(Nikola Irinchev)
July 1, 2021, 8:25am
2
Similarly to your other question, this is a matter of using the correct namespace. If you scroll toward the top of the API docs, you can see the namespace in which the App
class is located:
And again, if you already have an App
class defined in a different namespace, you can use the fully qualified name for the Realm one:
var currentUser = Realms.Sync.App.CurrentUser;
@nirinchev no, CurrentUser is not a static function so it can’t be call like that.
Will need an instance of Realms.Sync.App like this
var app = Realms.Sync.App.Create(new AppConfiguration("ID"));
var user = app.CurrentUser;
The documentation should be write more careful.
nirinchev
(Nikola Irinchev)
July 1, 2021, 8:51am
4
Good point, we’ll update the docs.