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

Serialize KeyValuePair as [Key,Value] in JSON

I need to return json with this structure : {"asks": [[PRICE, AMOUNT], ...], "bids": [[PRICE, AMOUNT], ...]} PRICE is decimal. AMOUNT is decimal example {"asks":[[7.449,1],[7.4499,6.711]], "bids":[[7.40001,5],[7.3325,27.449]]} I have a…
Haddar Macdasi
  • 3,477
  • 8
  • 37
  • 59
2
votes
1 answer

Mapping JSON (jQuery) to KeyValuePair

I have a JSON object with numerous properties that I am submitting to a C# web service via jQuery.ajax() - it looks something like this: var obj = {}; obj.LanguageCode = 1031; obj.Gender = { 'Geschlecht': 'Mann' }; obj.City = { 'Stadt': 'Berlin'…
emo
  • 43
  • 1
  • 5
1
vote
1 answer

Grabbing an array value by it's key

I would like to start off by saying that I have looked a good amount for this solution, but all I find is the opposite. That is, I'm trying to figure out how to get the value attached to a certain key in the array, but all I can find is grabbing the…
Joshua
  • 4,270
  • 10
  • 42
  • 62
1
vote
1 answer

Persist list of key/value pairs between the controller and views

I am working with C# in a .NET Core MVC web application and I would like to keep a persistent list of key/value pairs between the controller and views throughout multiple calls back to the controller accumulating the pairs as I go along. Is there a…
user4059321
1
vote
1 answer

How to copy/transfer key and values from 1 dictionary to another new dictionary/list?

I am a beginner to the Key-Value manipulation. I currently have 2 dictionaries.First dictionary with the original key and value. var firstDict = new Dictionary(); key:a ,value: 1 key:b ,value: 2 key:c ,value: 1 key:d ,value: 3 key:e…
1
vote
1 answer

How to get same values from different keys in a Dictionary?

Newbie Alert: I'm very new to using Dictionary or anything related to KeyValuePair.I have a Dictionary and I added some values to it.var first_choice_dict = new Dictionary(); The names are the keys and the numbers are value which…
1
vote
3 answers

Remove key/value pairs with the same value (i.e. duplicates) in an object in Javascript

I'm currently learning JS and I need a way to return an object that is similar to the given object but removing key/value pairs that have the same value (i.e. duplicates). So if I had a given object { a: 1, b: 2, c: 3, d: 1 }: it should return: {b:…
ruggle
  • 109
  • 1
  • 5
1
vote
1 answer

Angular *ngFor keyvalue sorting is not applied

I'm trying to create a live scoreboard for a game where I'm feeding my app with a logfile. I'm using public players = {}; // To contain a list of players where the string is the key. play.model.ts looks like this: export class…
1
vote
2 answers

How to access KeyValuePair collection as JSON array

I'm making Ajax calls to a page in ASP.NET Core 3.1. The response is a JsonResult whose Value property is an instance of a custom class, itself containing various string and collection properties. One of these collections is a Dictionary
ChrisA
  • 4,163
  • 5
  • 28
  • 44
1
vote
1 answer

Is it possible to create a serialization surrogate for a LinkedList of KeyValuePairs in C#?

Currently trying to implement a saving and loading system in a unity project to be able to save and reload states of the game. The project is similar to a tabletop card game where there are cards and stacks of cards. The stacks of cards contain a…
1
vote
5 answers

How can i display key value pairs in a table grid in react js.?

I'm trying to display key-value pairs in react js, but somehow I cannot display them properly. I have created a table widget and I am not getting the right display My table Widget import React from "react"; function Table(props) { const {…
Abdul Rauf
  • 90
  • 2
  • 14
1
vote
0 answers

How to extract Key-Value pair from Excel and convert into JSON using Python and/or with Online converter format

i have below dataset which need to convert to JSON format with no header. Is there a python code to extract in below format or an online converter or should I change my csv file format Input: Afghanistan AF Aland Islands AX Albania …
sanjana jha
  • 209
  • 3
  • 14
1
vote
3 answers

How to retrieve the Value of KeyValuePair from database in C#?

I am working on a project involving KeyValuePair. I have int as key, and string as Value. What I want is I want to get the Value from KeyValuePair. I have this code: var list = new List>() { new KeyValuePair
Rohan Rao
  • 2,505
  • 3
  • 19
  • 39
1
vote
3 answers

Creating key-value pairs from SQL result that have duplicate data

My problem at the moment is I have results coming back from a SQL query that returns a result like this: 125 Month 10.00 Wholesale 125 Year 20.00 Wholesale 126 Month 20.00 Wholesale 126 Year 30.00 Wholesale 127 Month 40.00 …
Ceri Westcott
  • 300
  • 2
  • 14
1
vote
3 answers

Assigning Values to KeyValuePair

I want to assign some static values to my KeyValuePair object. private IEnumerable> getCountries() { return new List>() { { "code1", "value1" }, { "code2", "value2" } …
Mohammad Irshad
  • 139
  • 3
  • 11