获取字段的行号而不使用ac#parser

我想获得一个类型字段的行#s。

要获取方法中语句的行#,这很简单:

Type type = typeof(MyClass); MethodInfo methodInfo = type.GetMethod("SomeMethod"); int token = methodInfo.MetadataToken; ISymbolReader reader = SymUtil.GetSymbolReaderForFile(@"dllName", null); // from mike stall's pdb2xml ISymbolMethod methodSymbol = reader.GetMethod(new SymbolToken(token)); int count = methodSymbol.SequencePointCount; ISymbolDocument[] docs = new ISymbolDocument[count]; int[] startColumn = new int[count]; int[] endColumn = new int[count]; int[] startRow = new int[count]; int[] endRow = new int[count]; method.GetSequencePoints(offsets, docs, startRow, startColumn, endRow, endColumn); 

不幸的是,获取构造函数的局部变量是不够的,因为某些类型的变量可以是const / static。