Questions tagged [keyvaluepair]

Defines a key/value pair that can be set or retrieved.

Defines a key/value pair that can be set or retrieved. The most common key/value pair used is HTTP GET paramaters which take the form of:

key1=value1&key2=value2&key3=value3

This syntax makes this type of storage very open-ended as you continue to append the next key/value pair to the end of the string.


In the mscorlib library (from MSDN)

Namespace: System.Collections.Generic

Type Parameters

TKey

The type of the key.

TValue

The type of the value.

Read more and view examples at MSDN

440 questions
2
votes
2 answers

Javascript: Add key/value pairs in nested dict; key and value are variables

I have a dictionary of the following structure: myDict = {key1:{innerKey1:innerValue1, innerKey2:innerValue2}, key2:{},...} Based on: How can I add a key/value pair to a JavaScript object? I tried to add inner key/value pairs like…
Shushiro
  • 577
  • 1
  • 9
  • 32
2
votes
1 answer

How to compare values from one SortedDictionary to Add them to a new SortedDictionary?

I have 2 SortedDictionary "mainsd" && "valuesd". The conditions I'm trying to program says the following: If the sum of Values of the 2 Keys above the MaxValue in "mainsd" is greater than or equal to the sum of Values of the 2 Keys below…
Koda
  • 37
  • 5
2
votes
1 answer

Storing Delegates in Dictionary

I am attempting to subscribe delegates to an event held in a List The goal is to associate a series of Handlers to keyboard keys and named axes, both of which are represented by Enums Dispatching is fairly easy, I…
Azeranth
  • 151
  • 11
2
votes
1 answer

How are KeyValuePairs compared for equality?

I have two arrays of KeyValuePair. I am comparing the two arrays, but noticed that when the value of the KeyValuePair is a value type cast to an object, like object{int}, two pairs with identical keys and value values are not…
pavuxun
  • 411
  • 2
  • 15
2
votes
2 answers

Dynamically add key value pair in jSON object using shell

I have a json object named version6json as follows { "20007.098": { "os_version": "6.9", "kernel": "2.6.32-696", "sfdc-release": "2017.08" }, "200907.09678”: { "os_version": "6.9", "kernel": "2.6.32-696", …
2
votes
1 answer

How can I retrieve a value from a list of key/value pairs with the key from a given pair?

I have the following list of pairs val mItemArray : ArrayList> = arrayListOf() I/System.out: [Pair{256 yeet}, Pair{128 yeah_boy}, Pair{64 spaghet}, Pair{32 screaming_kid}, Pair{16 nice}, Pair{8 leeroy}, Pair{4 wow}, Pair{2…
Martin Erlic
  • 5,467
  • 22
  • 81
  • 153
2
votes
2 answers

Search elements of an array by key value

I have the following PHP code which searches the array by the key name and returns result equals to the search. Just for curiosity how can I do that, that no matter what I search for the result will be elements where the name key value equals "A"?…
codeDragon
  • 555
  • 1
  • 8
  • 28
2
votes
2 answers

Using gather() to gather two (or more) groups of columns into two (or more) key-value pairs

I want to gather two seperate groups of columns into two key-value pairs. Here's some example data: library(dplyr) library(tidyr) ID = c(1:5) measure1 = c(1:5) measure2 = c(6:10) letter1 = c("a", "b", "c", "d", "e") letter2 = c("f", "g", "h", "i",…
Benjamin Telkamp
  • 1,451
  • 2
  • 17
  • 31
2
votes
1 answer

PHP key value pairs, where key is a dynamic variable and value is an array?

I am trying to create a 2D array where $multiples[$i] = array(multiples of $i), $i = 1,2,3... function getMultiples($factor, $start = 0, 10) { $multiples = array(); for($i = $factor + $start; $i < 10; $i+=$factor) $multiples[] = $i; return…
bagel
  • 23
  • 5
2
votes
2 answers

Create XML with variable element names from a data table with values and names

I wasn't able to find a relevant post, so I decided to ask. I have the following table in my SQL Server database: ID attname value --------------------------------- 22405543 blktradind N 22405543 brkref IRVTGB2X 22405543 buyamt …
Panos
  • 55
  • 7
2
votes
2 answers

Convert an RDD into a key value pair RDD, with the values being in a List

I have an pairRDD with tuples being in the following form: [(1,"b1","c1","d1","e1"), (2,"b2","c2","d2","e2"), ... What I want is to transform the above into a key-value pair RDD, where the first field will be the key, and the second field a list of…
hammad
  • 117
  • 4
  • 11
2
votes
3 answers

Searching for hidden key-value pairs in dictionary

I need to extract very specific key-value pairs from a dictionary. The keys are whole numbers and the values repeat for a certain number of keys, which varies. I must extract the last key-value pair for the repeated value. So, in this case, I need…
Capriles
  • 23
  • 3
2
votes
0 answers

Using find in a map just for one of the keys in a pair

I have a map called: std::unordered_map < std::string, struct > g_users but I would like to enter a second key, so that I could work with: std::unordered_map < std::pair < std::string, int> struct> g_users Is there any way of using the find…
paulzaba
  • 91
  • 6
2
votes
1 answer

Spark: Change the Key of key value pair

Is it possible to change the key of a key-value pair ? I load from different folders and the key is currently just the path to the file, but I want to change the key into a Integer depending from which folder the file comes. dir_pair_data =…
Koksi
  • 51
  • 2
  • 7
2
votes
2 answers

C# - Nested KeyValuePairs for a dropdown list

I have a dropdown control placed on a winform. Today the datasource for this dropdown is KeyValuePair<'string','string'> and hence it is easy to directly assign the 'DisplayMember' property of the dropdown to 'Value' from the KeyValuePair. One of my…
anand
  • 21
  • 4