Как насчет того, чтобы добавить params
перегрузка?
кроме того, необходимо ввести их как IDictionary
для максимальной гибкости.
public static IDictionary<TKey, TValue> Merge<TKey, TValue>(IEnumerable<IDictionary<TKey, TValue>> dictionaries)
{
// ...
}
public static IDictionary<TKey, TValue> Merge<TKey, TValue>(params IDictionary<TKey, TValue>[] dictionaries)
{
return Merge((IEnumerable<TKey, TValue>) dictionaries);
}
См. Здесь: Как получить родительский процесс в .NET управляемым способом
По ссылке:
using System.Diagnostics;
PerformanceCounter pc = new PerformanceCounter("Process",
"Creating Process ID", Process.GetCurrentProcess().ProcessName);
return Process.GetProcessById((int)pc.NextValue());
[Edit: См. Также Часто задаваемые вопросы о System.Diagnostics для получения дополнительной информации об этом. Спасибо Джастину за ссылку.]
$('#container').children().not('select');
Если ваша проблема в том, что дочерние элементы select
все еще включены, вы можете явно отфильтровать их с помощью метода .not ():
$('#container').children().not('select, option, optgroup');
или выбрать только прямые дочерние элементы:
$('#container > :not(select)');
Вы можете попробовать из селекторов jQuery в интерактивного тестера селекторов jQuery для быстрой обратной связи; попробуйте, например, div: not (ol)
или div>: not (ol)
, чтобы понять, какие различия делает селектор прямого дочернего (>
) .
Обработчик кликов JQuery для всего, кроме определенного объекта
Два подхода к проблеме: тот, который набрал 8 голосов , вероятно, тот, который вы ищете.
:not
, and .not()
to select and filter » Live DemoThe :not(selector)
does exactly this, and it comes in a couple styles. You can use the selector, or the method. Below is an example of using the selector:
$("#container :not(select)");
This will match any child within #container
that is not a element. Then we have the method fashion of exclusion, which goes by the same name, but must be ran differently:
$("#container").children().not("select");
This runs against the children
of the matched elements. In this case, .not
acts as a filter. Which brings me to the next example, using .filter()
to get the results you want. With this method, we can provide our own custom function to rummage through the results and pick the ones we want:
.filter()
to filter the matched elements » Live Demo$( "#container" ).children().filter( isNotSELECT ).fadeTo( "slow", .5 );
function isNotSELECT () {
// Returns TRUE if element is NOT select
return !$(this).is("select");
}
In this example, we select all of the children of #container
, and then pass them through a filter that we have defined called "isNotSelect". Within our filter, we return either true
or false
for every element. If we return true
, that element will be returned to the result set. If we return false
, that element will be removed from the result set. We're asking if the element is not a select. This will return false
for all select elements, thus removing them from our collection.
You can also try it using traversing methods:
$('#container').children().not('#selectorId');
or being a final option:
$('#container').children().filter(function(){
return $(this).attr('id') !== 'selectorId';
}
maybe this can help you где 3 - #select
попробуйте один из следующих вариантов:
$("#container *:not(eq(3))");
$("#container").children().filter(:not(eq(3)));
Непонятно, чего вы на самом деле хотите от своего вопроса. : not (select) отфильтрует выбранные из всех потомков, но не выберет потомков. Если это ваша проблема, попробуйте следующее
$("#container *").filter( function(){
return $(this).closest('select').length === 0
})