Quick question - I'm guessing the answer is no, but maybe someone has
come across this scenario before:
Is there a way to restrict the usage of an attribute so that it can
only be applied to properties with a particular return type? I
haven't been able to find anyone with a similar question in the land
of Google...
For example - I want to restrict my attribute so it can only be used
on string properties.
[AttributeUsage(AttributeTargets.Property)]
public class MyAttribute : Attribute { }
// This would compile
[MyAttribute]
public string PropA { get; }
// This would be a compilation error
[MyAttribute]
public int PropB { get; }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---