protected override string GetAttachedPropertyDeclaration(AttachedPropertyDefinition a) { string name = GetName(a); if (name == null) { return(null); } return("P:" + name); }
string GetDeclaration(IMemberDefinition member) { if (member == null) { throw new ArgumentNullException("member"); } TypeDefinition type = member as TypeDefinition; if (type != null) { return(GetTypeDeclaration(type)); } MethodDefinition method = member as MethodDefinition; if (method != null && method.IsConstructor) { return(GetConstructorDeclaration(method)); } if (method != null) { return(GetMethodDeclaration(method)); } PropertyDefinition prop = member as PropertyDefinition; if (prop != null) { return(GetPropertyDeclaration(prop)); } FieldDefinition field = member as FieldDefinition; if (field != null) { return(GetFieldDeclaration(field)); } EventDefinition e = member as EventDefinition; if (e != null) { return(GetEventDeclaration(e)); } AttachedEventDefinition ae = member as AttachedEventDefinition; if (ae != null) { return(GetAttachedEventDeclaration(ae)); } AttachedPropertyDefinition ap = member as AttachedPropertyDefinition; if (ap != null) { return(GetAttachedPropertyDeclaration(ap)); } throw new NotSupportedException("Can't handle: " + member.GetType().ToString()); }
protected virtual string GetAttachedPropertyDeclaration(AttachedPropertyDefinition a) { // check get and set member and craft string according string getter = $"Get{a.Name}"; string setter = $"Set{a.Name}"; var get = a.GetMethod; var set = a.SetMethod; if (get != null && set == null) { return($"see {getter}"); } else if (set != null && get == null) { return($"see {setter}"); } else { return($"see {getter}, and {setter}"); } }
protected virtual string GetAttachedPropertyDeclaration(AttachedPropertyDefinition a) { return($"see Get{a.Name}, and Set{a.Name}"); }