in src/Elastic.Clients.Elasticsearch/_Shared/Core/Extensions/TypeExtensions.cs [122:144]
private static void GetAllPropertiesCore(Type type, Dictionary<string, PropertyInfo> collectedProperties)
{
foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
{
if (collectedProperties.TryGetValue(property.Name, out var existingProperty))
{
if (IsHidingMember(property))
collectedProperties[property.Name] = property;
else if (!type.IsInterface && property.IsVirtual())
{
var propertyDeclaringType = property.GetDeclaringType();
if (!(existingProperty.IsVirtual() && existingProperty.GetDeclaringType().IsAssignableFrom(propertyDeclaringType)))
collectedProperties[property.Name] = property;
}
}
else
collectedProperties.Add(property.Name, property);
}
if (type.BaseType != null)
GetAllPropertiesCore(type.BaseType, collectedProperties);
}