Hi everybody,
Can anybody explain me about Custom Attributes and how are they implemented?. I mean what is the significance of using separate class for Attributes?
Thanks in advance,
abhid
Printable View
Hi everybody,
Can anybody explain me about Custom Attributes and how are they implemented?. I mean what is the significance of using separate class for Attributes?
Thanks in advance,
abhid
What do you mean by Custom Attributes? Like Serializeable?
no, I am referring to Attribute class in .NetQuote:
Originally posted by Edneeis
What do you mean by Custom Attributes? Like Serializeable?
Actually I have a huge code where I have some classes with tags like
and clsMyProperty class is defined likeVB Code:
Imports System.Reflection Public Class clsUserScreen <clsMyProperty(prp_UserName:="ABC", prp_Age:="40")> Public Property prp_User1() As String 'I want to Know working of this part ... End Property ... End Class
This is just a small example though. I have huge list of classes using custom attributes and I need to write some code based upon these classes. But first I want to understand this code fully although I will not be referring to these attributes in MY code.VB Code:
<AttributeUsage(AttributeTargets.All, inherited:=True, AllowMultiple:=False)> Public Class clsMyProperty Inherits Attribute 'This class is member of System #Region "Member Variables" Private strUserName As String Private strAge As String #End Region #Region "Class Propertis" Public Property prp_UserName() As String Get Return strUserName End Get Set(ByVal strValue As String) strUserName = strValue End Set End Property Public Property prp_Age() As String Get Return strAge End Get Set(ByVal strValue As String) strAge = strValue End Set End Property #End Region End Class
I read in MSDN regarding Attribute class but I want to know what is exact significance of using custom attributes for a class property.