Reputation: 1020
I'm working with a new Windows Phone 8 App, and trying to list the contacts on the phone.
In debug mode I can see the member Id (Contact.Id) with small blue icon next to the member (not an extension) but I can't access this member in programming mode, and can't view it when typing A = Contact.Id !, and can't find any document about it event on Microsoft site I can't find the member: microsoft.phone.userdata.contact.id what is the type of this member?
Upvotes: 3
Views: 435
Reputation: 10970
I just realized that
contact.GetHashCode()
returns the exact same number as the Id
property seen in the variable window drilldown.
Not sure how reliable it is, and how reliable it will be in the future.
Upvotes: 3
Reputation: 16102
Id is a private/protected/internal property of the Contact class. That means that in terms of the Silverlight runtime it's a non-accessible member. And that means you won't be able to get that value at runtime. Contact.Id is out of your reach.
Silverlight respects access levels and will only let you access members in the access level for the calling code. For example, all class can invoke all public members (properties, methods, events, fields, etc) of all other classes. As another example, only classes in the same assembly can invoke internal members of classes in the same assembly. If any class outside that assembly attempt to access internal members they'll get a MemberAccessException. And as a final example if a class declares private members (e.g. private field) then only that class can access that private members. If another class attempts to access private values inside a class it'll receive a MemberAccessException.
The above is true for both runtime (Reflection) invoked members and for compile-time (hardcoded) invoked members.
Upvotes: 3