Cody,
Yes, the C# compiler geenrates set and get methods to handle a property.
However, during design time, these methods are called accessors and belong
to a single property. Attributes can only be applied to a class or members
of a class. The property is a member of a class. Accessors are members of
the property, therefore, they cannot have attributes.
Telmo Sampaio
MCT
"cody" <de********@gmx.de> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
You know that set and get accessors *are* individual methods? I see no
reason why I can't put attributes on individual accessor methods.
"David Anton" <Da********@discussions.microsoft.com> schrieb im
Newsbeitrag
news:AC**********************************@microsof t.com... That's not a bug - you can't apply attributes to an individual "set" or
"get". Methods can have attributes specified prior to the method header
and prior to individual parameters.
David Anton
Tangible Software Solutions Inc.
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
VB.NET converter
"cody" wrote:
> public decimal Wert
> {
> get{return this.wert;}
> [Obsolete]
> set{this.wert=value;}
> }
>
> This doesn't compile. It gives me error CS0592 and says that obsolete cannot > be applied to that elemet.
>
>
>