C# Get FieldInfos/PropertyInfos in the original order?

前端 未结 5 667
独厮守ぢ
独厮守ぢ 2020-12-03 13:42

How can I get a Types FieldInfos/PropertyInfos as a MemberInfo array in the order they are laid out in the class?

class Test
{
    public bool First { get; s         


        
5条回答
  •  天命终不由人
    2020-12-03 14:14

    The line number information is not compiled in to the assembly, it is stored in the .PDB file for the use of debugger.
    Although technically it may be possible to get the information you are looking from the PDB file, I don't think that will be a good idea either, as the PDB file will not be present in the production environment. Even if it is there there is no guarantee that it is in sync with the DLL.

提交回复
热议问题