Beispiel #1
0
        /// <summary>
        /// Gets the annotation elements for a <see cref="XDocument"/>.
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        IEnumerable <XElement> SerializeDocument(XDocument document)
        {
            Contract.Requires <ArgumentNullException>(document != null);

            // emit annotations configured on the object itself
            foreach (var annotation in document.Annotations <object>())
            {
                var obj = SerializeAnnotation(document, annotation);
                if (obj != null)
                {
                    obj.SetAttributeValue(NX_FOR, NX_FOR_DOCUMENT);
                    yield return(obj);
                }
            }
        }
 // ReSharper disable once SuggestBaseTypeForParameter
 private static string GetCompetitionName(this Target target, XDocument xmlAnnotationDoc) =>
 xmlAnnotationDoc.Annotations <UseFullTypeNameAnnotation>().Any()
                         ? target.Type.GetShortAssemblyQualifiedName()
                         : target.Type.Name;