Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public Protected ??? What? Huh?
Message
De
13/12/2004 09:46:17
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00968674
Message ID:
00968727
Vues:
11
Yeah, Eric ... that's annoying. The IDE does not do that with WinForms (and in fact, the default is private rather than protected), so it's curious that it does it with WebForms. But, anyway, the way to solve your problem is to let the IDE have it's way, and for the members that you want to be public, make a property for them.
protected TextBox m_MyTextBox;

public TextBox MyTextBox
{
  get {return this.m_MyTextBox;}
  set {this.m_MyTextBox = value;}
}
This is the preferred way of exposing public properties anyway, although to be honest I don't always do it when I'm feeling lazy. <g>

~~Bonnie



>Does anyone know how to prevent this incredibly irritating thing .net does when it arbitrarily sets members of a web form to Protected when I specifically set them to public? Any time I edit a webform and add a control or modify a property of a control it resets all the controls to Protected which causes the compiler to blowup.
>
>When I set a member to Public I do it for a reason and I expect it to stay that way until I say otherwise. I am constantly having to reset members to public access. I don't want the IDE deciding for me what access settings I need in my code!
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform