How to get a property DescriptionAttribute

Mansour_Dalir 2,036 Reputation points
2023-06-11T17:40:15.5333333+00:00

enter image description here hi this My Property

    <CategoryAttribute("_All Setting"), DefaultValueAttribute(""),
    DescriptionAttribute("پیروی سطر یا سلول از جدول والد" & vbNewLine & "گرفتن اعتبار (سطر از جدول مشخص) یا (سلول از ستون جاری) جهت جلوگیری از اشتباهات" &
    vbNewLine & "BeginColumn|CS|SQL|OtherTable/ColumnName|OtherColumn2=OtherTable.Column2" & vbNewLine &
    "ColumnNameForBegin!|opt Connectin String|opt|OtherTable|optOtherColumnName=OtherTable.Column2|optOtherColumnName3|..." & vbNewLine &
    "notNull with'!',Set '='")>
    <Editor(GetType(claShowForm), GetType(UITypeEditor))>
    Public Property ValidateRowOfParent As String
        Get
            Return Pro.ValidateCellOrRowOfParent
        End Get
        Set(value As String)
            If value IsNot Nothing AndAlso (value.Length > 2 AndAlso Mid(value, value.Length - 1, 2) = vbNewLine) Then
                value = Mid(value, 1, value.Length - 2)
            End If
            Pro.ValidateCellOrRowOfParent = value
        End Set
    End Property

 Public Sub _Load()
        Dim props() As System.Reflection.PropertyInfo = Me.GetType.GetProperties(BindingFlags.Public Or
              BindingFlags.Instance Or BindingFlags.DeclaredOnly)
        Dim stt2 As String = props(2).Attributes(2).ToString 'ERROR
  End Sub
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,891 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mansour_Dalir 2,036 Reputation points
    2023-06-12T05:12:35.2666667+00:00
        Dim props() As System.Reflection.PropertyInfo = Me.GetType.GetProperties(BindingFlags.Public Or
                  BindingFlags.Instance Or BindingFlags.DeclaredOnly)
    
            Dim Result = props.Select(Function(g) If(Attribute.IsDefined(g, CType(GetType(DescriptionAttribute), Type)), TryCast(Attribute.GetCustomAttribute(g, CType(GetType(DescriptionAttribute), Type)), DescriptionAttribute).Description, Pro.GetType.Name)).ToArray
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.