IEnumerable <XamlMember> DoLookupAllMembers() { // This is a hack that is likely required due to internal implementation difference in System.Uri. Our Uri has two readonly collection properties if (this == XamlLanguage.Uri) { yield break; } //var bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; foreach (var pi in UnderlyingType.GetRuntimeProperties()) { if (pi.GetPrivateGetMethod()?.IsStatic ?? pi.GetPrivateSetMethod()?.IsStatic ?? false) { continue; } if (pi.Name.Contains(".")) // exclude explicit interface implementations. { continue; } if (pi.CanRead && ( pi.CanWrite || IsCollectionType(pi.PropertyType) || typeof(IXmlSerializable).GetTypeInfo().IsAssignableFrom(pi.PropertyType.GetTypeInfo()) || pi.GetCustomAttribute <ConstructorArgumentAttribute>() != null ) && pi.GetIndexParameters().Length == 0) { yield return(SchemaContext.GetProperty(pi)); } } foreach (var ei in UnderlyingType.GetRuntimeEvents()) { yield return(SchemaContext.GetEvent(ei)); } }
public IEnumerable <MemberBase> GetAllMembers() { var properties = UnderlyingType.GetRuntimeProperties().Where(IsValidMember).ToList(); return(properties.Select(props => GetMember(props.Name))); }