Как отправить, несколько аргументов jQuery нажимают функцию?

Вам не нужен LINQ, просто некоторые изящные дополнительные методы:

public static IDictionary<TKey, TValue> Sort<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
{
    if(dictionary == null)
    {
        throw new ArgumentNullException("dictionary");
    }

    return new SortedDictionary<TKey, TValue>(dictionary);
}

public static IDictionary<TKey, TValue> Sort<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, IComparer<TKey> comparer)
{
    if(dictionary == null)
    {
        throw new ArgumentNullException("dictionary");
    }

    if(comparer == null)
    {
        throw new ArgumentNullException("comparer");
    }

    return new SortedDictionary<TKey, TValue>(dictionary, comparer);
}

использование В качестве примера:

var dictionary = new Dictionary<int, string>
{
    { 1, "one" },
    { 2, "two" },
    { 0, "zero" }
};

foreach(var pair in dictionary.Sort())
{
    Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
}

// 0: zero
// 1: one
// 2: two
10
задан NakedBrunch 17 December 2011 в 04:36
поделиться

3 ответа

jQuery Events

jQuery .click()

$('.myclass').bind("click", { Param1: "", Param2: 2 }, function(event){
    alert(event.data.Param2);
});
18
ответ дан 3 December 2019 в 19:34
поделиться

you can use bind() and send additional data to the event handler as event.data

1
ответ дан 3 December 2019 в 19:34
поделиться

this may not be the best method, but something i have done is to hyphen delineate the id attribute with other params, like id="101-red-420582" which all three mean different things and can be easily broken down using the split() function. not the best, per se, but i've done it and it works.

1
ответ дан 3 December 2019 в 19:34
поделиться
Другие вопросы по тегам:

Похожие вопросы: