Attribute

  • Thread starter Thread starter Polo
  • Start date Start date
P

Polo

Hi,

I define a CustomAttribute

public class CustomAttribute : Attribute
{
...

public Something()
{
??? Ow can I retrieve the instance or type that host this attribute
}
}

I apply it on a class

[CustomAttribute()]
public class Test
{
}
 
In fact I would like to create a Custom Attribute that is used in a
CustomTypeConverter to set IsReadOnly on all properties when a property of
the instance of the Class that host this attribute is true or false. (Lock
an instance)
But I think that I found a solution (In my CustomAttribute, I have a field
that define the name of the property and by reflexion i can retrieve
information)
Thank's


Sean Hederman said:
AFAIK you can't. What exactly are you trying to do with this?

Polo said:
Hi,

I define a CustomAttribute

public class CustomAttribute : Attribute
{
...

public Something()
{
??? Ow can I retrieve the instance or type that host this
attribute
}
}

I apply it on a class

[CustomAttribute()]
public class Test
{
}
 
Back
Top