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