Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read only property
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01095599
Message ID:
01095601
Vues:
9
Hi Einar,

It looks like you want to modify the visibility of the set accessor, so you can work with the property internally but restrict it externally?

Asymmetric Accessor Accessibility was added to C#2.0 , this lets you add the keyword 'internal' to either a get or set accessor to restrict it's visibility.

the only caveat is you must always have both the get and the set accessor to use this function, should be fine for your example.
public string MyProp
{
    get { return this.myProp; }
    internal set { this.myProp = value; }
}
- Craig
- Craig

"If you're not prepared to be wrong, you will never come up with anything original."
- Sir Ken Robinson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform