Пример #1
0
        /// <summary>
        /// Allows an <see cref="AssemblyElement"/> to be visited.
        /// This method is called when the element accepts this visitor
        /// instance.
        /// </summary>
        /// <param name="assemblyElement">
        /// The <see cref="AssemblyElement"/> being visited.
        /// </param>
        /// <returns>
        /// A <see cref="IReflectionVisitor{T}" /> instance which can be used
        /// to continue the visiting process with potentially updated
        /// observations.
        /// </returns>
        /// <remarks>
        /// <para>
        /// This implementation relays <see cref="TypeElement"/> instances
        /// from <see cref="Assembly.GetTypes()"/>, to <see cref="Visit(TypeElement[])"/>,
        /// but since the method is virtual, child classes can override it.
        /// </para>
        /// </remarks>
        public virtual IReflectionVisitor <T> Visit(
            AssemblyElement assemblyElement)
        {
            if (assemblyElement == null)
            {
                throw new ArgumentNullException("assemblyElement");
            }

            return(Visit(assemblyElement.GetTypeElements()));
        }
Пример #2
0
 public override IReflectionVisitor <IEnumerable <object> > Visit(
     AssemblyElement assemblyElement)
 {
     throw new NotSupportedException("Collecting values from an entire assembly is not supported. ValueCollectingVisitor collect values from a single object (the 'target'), and the values collected must correspond to fields or properties on that object. Attempting to collect values from an entire Assembly is meaningless, because an Assembly normally defines more than a single type. In the rare case where you have an assembly with only a single type, use the Visit(TypeElement) overload instead.");
 }