Retriving attribute from custom attribute collection

Retriving attribute from custom attribute collection

Post by Victo » Tue, 05 Jun 2001 23:50:25



Hi,

I created custom attribute collection. How can I declare that attribute in
front of the class and how to extract contents of that attribute collection.
[AttributeUsage(AttributeTargets.All)]

public class RoleAttribute : Attribute {

public RoleAttribute(string[] pRString){

this.pRString = pRString;

Quote:}

private string[] pRString;

public string[] RString {

get {

return pRString;

Quote:}
}

For example, when I had custom attribute without collection I would declare
it before some class as following:
[Role("Supervisor")]

or

[Role("Manager")]

Thank you,

Victor

 
 
 

1. retrieving an attribute from an attribute collection

Hi, i have the following

Public Function load( _
  ByRef rxmlData As System.Xml.XmlElement) As
Boolean

Dim xmlAttribute As System.Xml.XmlAttribute
dim intAttributeIndex as integer = 1

xmlAttribute = rxmlData.Attributes.Item
(intAttributeIndex)

this blows up with the following error

C:\Personal\Develop\VisualBasic.Net\buildDirector\
dom\CFile.vb(75) : error BC30521: No accessible
overloaded 'Item' is most specific for these
arguments. Cannot choose between these:

    For overload candidate 'Overrides Function
Item(index As Integer) As System.Xml.XmlNode':
Not most specific.

    For overload candidate 'Overrides ReadOnly
Default Property Item(i As Integer) As
System.Xml.XmlAttribute': Not most specific.

looks like the compiler can't figure out whether
to use the property or the function... does
anyone know of a workaround for this?

Thanks!

Sent via Deja.com
http://www.deja.com/

2. HELP!! New IPAQ 3650 w/ethernet - I have NT4 - How to get Activesync working?

3. Error emitting 'attribute' attribute -- 'reason' CS0647

4. Geobook

5. Urgent: extracting XML attribute and attribute value through XSL

6. Cisco's CIP Card

7. howto: Write custom attributes to other controls from within custom control's code

8. Keyboard for E-10 & other WinCE in Sep 98.

9. Error emitting 'attribute' attribute -- 'reason' CS0647

10. radiobuttonlist, add attributes to web controls collection items

11. problems in getting custom attributes in a structures element

12. How to get class level custom attribute

13. Custom Attributes Problem