> > -----Original Message----- > > From: Chris Day [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, October 21, 2003 7:27 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [ADVANCED-DOTNET] Do properties need a > 'holder' keyword? > > > > I know that when using properties there are a lot of read only (get > > accessor only) properties which would be useful to have > auto-generated > > for me. Think of the Count property in a collection. > Internally it's > > read/write but externally the property has a get accessor only. > > > > Having a short-hand way to do this would be cool. > > > > Chris > > > > It would be nice if property getters/setters could have > individual access modifiers. > > That way you can do something like: > > public int Count { get { return _count; } } > private int Count { set { _count = value; } }
Afaik, you can. Define the property get on another interface than the set. Then implement the interface directly: protected int IFoo.Count {{ get return _count;}} public int IBar.Count {{ set _count=value;}} IBar then inherits from IFoo, so when you do not want the set, cast to IFoo. FB =================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com