apm,
No, I'm thinking something more like this:
public class MyAttribute : Attribute
{
// You can put other stuff in here.
}
public enum Goups
{
[field:MyAttribute]
sCH3
}
You can then write a generic routine that takes the enumeration value,
as well as the attribute to return, and return it. It works pretty well.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"apm" <(E-Mail Removed)> wrote in message
news:1QBWe.11752$nq.8126@lakeread05...
>
> "Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote
> in message news:(E-Mail Removed)...
>> Alan,
>>
>> As others have mentioned, no, you can not. In this situation, what I
>> like to do is declare an enumeration, and then apply attributes to the
>> values of the enumeration (after all, they are static fields) which I
>> retrieve at runtime to get the information I need.
>
> Are you thinking of somethine like:
>
> public enum Goups
> {
> sCH3,
> etc.
> }
>
> GroupAttributes ga = new GroupAttributes (etc.)
>
> GroupAttributes [] gaArray = new etc.
>
> gaArray[(int)sCH3] = ga;
>
> In words: (1) make enum (2) use enum to refer to attributes stored in an
> array
> ???????
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - (E-Mail Removed)
>>
>> "A.M-SG" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi,
>>>
>>> Can I have enum contain strings?
>>>
>>> Thank you,
>>> Alan
>>>
>>>
>>
>>
>
>