public static TripleSlashCommentModel?CreateModel(string xml, TripleSlashCommentParserContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (string.IsNullOrEmpty(xml)) { return(null); } // Quick turnaround for badly formed XML comment if (xml.StartsWith("<!-- Badly formed XML comment ignored for member ", StringComparison.Ordinal)) { Logger.LogWarning($"Invalid triple slash comment is ignored: {xml}"); return(null); } try { var model = new TripleSlashCommentModel(xml, SyntaxLanguage.CSharp, context); return(model); } catch (XmlException) { return(null); } }
// ReSharper disable once CognitiveComplexity public void CopyInheritedData(TripleSlashCommentModel src) { if (src == null) { throw new ArgumentNullException(nameof(src)); } Summary ??= src.Summary; Remarks ??= src.Remarks; Returns ??= src.Returns; if (Exceptions == null && src.Exceptions != null) { Exceptions = src.Exceptions.Select(e => e.Clone()).ToList(); } if (Sees == null && src.Sees != null) { Sees = src.Sees.Select(s => s.Clone()).ToList(); } if (SeeAlsos == null && src.SeeAlsos != null) { SeeAlsos = src.SeeAlsos.Select(s => s.Clone()).ToList(); } if (Examples == null && src.Examples != null) { Examples = new List <string>(src.Examples); } if (Parameters == null && src.Parameters != null) { Parameters = new Dictionary <string, string>(src.Parameters); } if (TypeParameters == null && src.TypeParameters != null) { TypeParameters = new Dictionary <string, string>(src.TypeParameters); } }