No, you have to assign it to the whole property. I tried to do this:
public static string Home
{
[method: Obsolete]
get
{
return null;
}
[method: Obsolete]
set
{
}
}
And it gave me this:
Error 1 Attribute 'Obsolete' is not valid on property or event accessors. It
is valid on 'class, struct, enum, constructor, method, property, indexer,
field, event, interface, delegate' declarations only.
c:\temp\WindowsApplication1\WindowsApplication1\Program.cs 23 14
WindowsApplication1
Note, you can attach other attributes to the accessors inside a
property, just not the Obsolete one. For example, the Description attribute
can be applied like so:
public static string Home
{
[method: Description("hello")]
get
{
return null;
}
[method: Obsolete]
set
{
}
}

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Does anyone know if it's possible to apply an ObsoleteAttribute to just
> the
[quoted text clipped - 4 lines]
> Thanks,
> DlgProc