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
5
votes
1 answer

c# List Get Value by Key Or Index

How to get value by key for keyKeyValuePair I have a List> var dataList = new List>(); // Adding data to the list dataList.Add(new KeyValuePair("name",…
Amr SubZero
  • 1,196
  • 5
  • 19
  • 30
5
votes
1 answer

Returning dynamic key value collection in ASP.NET Web API

I am developing an ASP.Net Web API project. In my project, I am trying to return JSON from action in this format. { "Apple": null, "Microsoft": null, "Google": 'http://placehold.it/250x250' } As you can see in the JSON, it is key value pairs.…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
5
votes
3 answers

Spark: How RDD.map/mapToPair work with Java

I have some pairs cw (Integer i, String word) with i number of occurences of word in a text file. I would like to simply have for each pair a new pair c1 (Integer i, 1) with 1 fixed number. It seems to be really trivial but I haven't understood how…
rugrag
  • 163
  • 1
  • 1
  • 7
5
votes
2 answers

How to iterate through a collection of KeyValuePair

I am iterating through a collection of KeyValuePair, then copying the Key and Value to a newly-created class as follows : Classes.MemberHierarchy membHier = new Classes.MemberHierarchy(); List membHierList = new…
bob.mazzo
  • 5,183
  • 23
  • 80
  • 149
5
votes
3 answers

KeyValuePair in Lambda expression

I am trying to create a KeyValue pair collection with lambda expression. Here is my class and below that my lambda code. I failed to create the KeyValuePair. I want to get a collection of KeyValuePair of Id, IsReleased for the comedy movies. I…
Murali Murugesan
  • 22,423
  • 17
  • 73
  • 120
4
votes
2 answers

Remove duplicate items from KeyValuePair List by Value

I have a List of KeyValuePair in C# formatted as KeyValuePair. I want to remove items having duplicate values from List. The Point object having {X,Y} coordinates. Sample Data: List> Data= new…
Sandeep Jadhav
  • 815
  • 1
  • 10
  • 27
4
votes
3 answers

how to convert array of objects to key value pairs in php

I have an array of objects and I need to convert to key value pairs, my code is i have a model as: model setting.php public function currency_info(){ $currency_info = [ ['code' => 'AED', 'name' => 'United Arab Emirates…
Prakash Poudel
  • 434
  • 1
  • 5
  • 17
4
votes
5 answers

How to convert key-value pair object into an array of values in ES6?

I'm developing a React application where I need to convert a key-value object like this: { 0: 'John', 1: 'Tim', 2: 'Matt' }; To an array of just the values like this: ['John', 'Tim', 'Matt'] How do I accomplish this? const obj = { 0:…
Barry Michael Doyle
  • 9,333
  • 30
  • 83
  • 143
4
votes
1 answer

Why is KeyValuePair 16 bytes?

KeyValuePair: 8 bytes KeyValuePair: 16 bytes KeyValuePair: 16 bytes (!!) KeyValuePair: 16 bytes (!!) I would expect the latter two pairs to require only 8 (long) + 4 (int) = 12 bytes. Why do they…
Timo
  • 7,992
  • 4
  • 49
  • 67
4
votes
2 answers

Check key / value pair in List

I have list declared as List> KPList = new List>(); I need to check if a combination of key and value already exists. I can't use dictionary since I need to have unique combination of key and…
Jameer Basha
  • 61
  • 1
  • 9
4
votes
5 answers

How to store key value pairs in Java without using HashMap or any other collection?

I want to be able to associate values to some keys without using collections. I am aware of HashMaps, but I am trying to explore a more basic way to do it. For example, if I was to count the frequency of each word in a file, I would take words as…
simar kaur
  • 211
  • 3
  • 7
  • 14
4
votes
1 answer

Bind List to combobox

I cannot create a class or my own object so I thought I would use a List to store two properties and then bind this object to a combobox. However, I cannot see how I can set the valueField and TextField in the combobox. The…
user3428422
  • 4,300
  • 12
  • 55
  • 119
4
votes
4 answers

Regex to extract key-value pairs separated by space, with space in values

Assume a one-line string with multiple consecutive key-value pairs, separated by a space, but with space allowed also within values (not in keys), e.g. key1=one two three key2=four key3=five six key4=seven eight nine ten Correctly extracting the…
PNS
  • 19,295
  • 32
  • 96
  • 143
4
votes
2 answers

How do I retrieve a Value from a KeyValuePair inside a List?

I have the following list and I need to run a Contains() or similar method on it to retrieve the value associated with a specific key. How would I do this? I've searched everywhere and tried many things but I can't seem to figure it…
Kelyn Ferguson
  • 143
  • 2
  • 7
4
votes
2 answers

How to get key from SelectedItem of ComboBox?

I am trying to get the key of SelectedItem of ComboBox but do not figure it out how to get code which I have done is, void CboBoxSortingDatagridview(ComboBox sender) { foreach (var v in DictionaryCellValueNeeded) { if…
Hassaan
  • 3,931
  • 11
  • 34
  • 67
1 2
3
29 30