开发者

Get Object Property Description using Reflection

开发者 https://www.devze.com 2023-03-21 16:43 出处:网络
How to get the object description using reflection. I can get the name, value, etc..开发者_开发知识库. but not the description like in .net.

How to get the object description using reflection. I can get the name, value, etc..开发者_开发知识库. but not the description like in .net.

For example the description for .Text is "Gets or sets the text associated with this control."

I thought maybe using MethodInfo, but does not give the description.

    Dim MethodObj As MethodInfo
    Console.WriteLine("Methods:")
    For Each MethodObj In GetType(TextBox).GetMethods()
        Debug.Print(MethodObj.Name & " " & MethodObj.ReturnType.ToString())
    Next


If you mean the description as shown in MSDN, that's not part of the metadata shipped with the executable code. If you've got the XML documentation to go alongside the assembly, you could try to find the right method in that - but in most cases I wouldn't expect it to be available.


You can't get this description via reflection, because it is not compiled into the assembly. During compilation an XML documentation file is generated that contains this description. You need to parse this XML file to get the description. However, you don't always have this file, because it is not required to execute the assembly.

0

精彩评论

暂无评论...
验证码 换一张
取 消