mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!B 没有过滤保护和内部等其他类型字段,导致出现多次
This commit is contained in:
parent
113eb4b48d
commit
574e3457f6
@ -98,8 +98,12 @@ namespace XNode {
|
||||
|
||||
// GetFields doesnt return inherited private fields, so walk through base types and pick those up
|
||||
System.Type tempType = nodeType;
|
||||
while ((tempType = tempType.BaseType) != typeof(XNode.Node)) {
|
||||
fieldInfo.AddRange(tempType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance));
|
||||
while ((tempType = tempType.BaseType) != typeof(XNode.Node))
|
||||
{
|
||||
//只返回私有的,保护等其他的不需要
|
||||
var fieldInfos = tempType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(x=>x.IsPrivate);
|
||||
|
||||
fieldInfo.AddRange(fieldInfos);
|
||||
}
|
||||
return fieldInfo;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user