Exemple #1
0
        /// <summary>
        /// Add list of types to the list.
        /// </summary>
        /// <param name="list">List of NamedTypeSelector items</param>
        /// <param name="name">An arbitrary but unique name (can be later used to remove types from the list)</param>
        /// <param name="types"></param>
        public static void Add(this IList <NamedTypeSelector> list, string name, params Type[] types)
        {
            XqCheck.NotNull(list, nameof(list));
            XqCheck.NotNull(name, nameof(name));
            XqCheck.NotNull(types, nameof(types));

            list.Add(new NamedTypeSelector(name, type => types.Any(type.IsAssignableFrom)));
        }
Exemple #2
0
        /// <summary>
        /// 创建<see cref="DisposeAction"/>对象,当这个对象被disposed时,执行<paramref name="action"/>
        /// </summary>
        public DisposeAction([NotNull] Action action)
        {
            XqCheck.NotNull(action, nameof(action));

            _action = action;
        }