Michael,

I got a response on this from Paul Vick [1], Technical Lead on VB.NET at
Microsoft:

"Custom attributes with Object or array parameters are not CLS compliant
and not supported in VB.NET. However, as you note, C# does support them.
We are considering removing this restriction in a future release."

---

[1] http://www.panopticoncentral.net
Paul's weblog (not the source of the answer)

---
Patrick Steele ([EMAIL PROTECTED])
Lead Software Architect
Image Process Design


> -----Original Message-----
> From: Patrick Steele 
> Sent: Tuesday, July 22, 2003 10:27 AM
> To: 'Moderated discussion of advanced .NET topics.'
> Subject: RE: [ADVANCED-DOTNET] Unable to use Custom Attribute 
> With String Array Parameter in Constructor
> 
> 
> Very interesting find Michael.  It's also interesting to note 
> that if you place the attribute in an assembly by itself, you 
> can reference that assembly in a C# project and use the 
> attribute without problems in C#:
> 
> [Parameter(new String[] {"test"})]
> public class Class1
> {
>       ...
> }
> 
> I've sent a note off to Microsoft to see if I can get 
> clarification as to if this is a bug or not.
> 
> ---
> Patrick Steele ([EMAIL PROTECTED])
> Lead Software Architect
> Image Process Design
> 
> 
> > -----Original Message-----
> > From: Michael Wolfenden [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, July 21, 2003 1:12 AM
> > To: [EMAIL PROTECTED]
> > Subject: [ADVANCED-DOTNET] Unable to use Custom Attribute 
> > With String Array Parameter in Constructor
> > 
> > 
> > I have created a custom attribute as follows :
> > 
> > <AttributeUsage(AttributeTargets.Class)> _
> > Public Class ParameterAttribute
> >     Inherits Attribute
> > 
> >     Private m_methodName As String()
> > 
> >     Public Sub New(ByVal methodNames As String())
> >         m_methodName = methodNames
> >     End Sub
> > 
> > End Class
> > 
> > But I get an error when trying to use it in VB.Net ie.
> > <ParameterAttribute(New String() {"test"})> _
> > Public Class SomeObject
> > 
> > End Class
> > 
> > How do I pass a string array to the attribute constructor ?
> > 
> > Any help would be much appreciated
> > 
> > 
> 

Reply via email to