I don't think it's possible but since I haven't got a definite clarity from MSDN, I feel that it's best to ask. Suppose that we have a class as follows.
public partial class Hazaa
{
public int Shazoo { get; set; }
}
Then, I'd like Shazoo to be attributed as SuperCool but I wish to do so in another file. Since I'm using partial classes, I can add new properties as follows.
public partial class Hazaa
{
[SuperCool]
public int Wheee { get; set; }
}
But can I attribute a property declared in the first sample by writing code in the latter? I doubt it's possible but I'll be glad to stand corrected. If so, what's the syntax?
No, you can't.
You can only attach attributes to members you declare there and then, and unless the member is also declared as partial (so that you may reimplement it elsewhere) you cannot attach attributes to members declared in another partial file.