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
3
votes
2 answers

Get Dictionary item as KeyValuePair

For me it seems to be obvious that a dictionary might have a method for getting it's item by Key. Either I am blind, or... However, I have following situation: A need a Dictionary(Of Integer, k/v). I have the k/v's already in a Dictionary and I'd…
dba
  • 1,159
  • 1
  • 14
  • 22
3
votes
4 answers

Sort array of dictionaries according to separate array ?

I have a bit of a strange problem. So I have an array of dictionaries say, ( Dict 1: "Name" = "B" "Number" = "2" Dict 2: "Name" = "A" "Number" = "1" Dict 3: "Name" = "D" "Number" = "4" Dict 4: "Name" = "C" "Number" = "3" Dict 5 "Name" =…
Milo
  • 5,041
  • 7
  • 33
  • 59
3
votes
2 answers

How to extract a value from a key/value pair in NSDictionary (iOS)

When debugging in XCode, the debugger is telling me that the NSDictionary object contains 1 key/value pair. When the debug console prints the description of the key/value pair is shows: Printing description of testdictionary: { "Unknown…
Nik The Greek
  • 33
  • 1
  • 4
3
votes
3 answers

Split into KeyValuePair instead of Array

I have a string of data: Key1=Value1,Key2=Value2,KeyN=ValueN I'm trying to split the string into List> I can easily do this: List values = item.Split( ',' ).Select( p => p.Split( '=' ) ).ToList(); but I…
Storm
  • 1,848
  • 4
  • 20
  • 39
3
votes
1 answer

Returning KeyValuePair from a Linq Compiled Query

I'm just getting to grips with Compiled Queries in Linq, and have come across some strange behaviour. This query compiles fine: public static Func GetJourneyByUrl = CompiledQuery.Compile
royse41
  • 2,310
  • 4
  • 22
  • 29
3
votes
2 answers

how to cmpare same types where IsGenericTypeDefinition is deff

I have a issue where I want to identify if a object is of type KeyValuePair<,> when I compare in if: else if (item.GetType() == typeof(KeyValuePair<,>)) { var key = item.GetType().GetProperty("Key"); var value =…
SairuS
  • 149
  • 1
  • 2
  • 11
3
votes
1 answer

Can't add new key-value to plist in Xcode

I must have some setting configured in Xcode that is stopping me to add a new plist key-value pair. Three weeks ago I upgraded to the latest Xcode version 4.5. Note: I didn't ever try adding a new key-value pair before so I don't know if this…
Dale Dietrich
  • 7,196
  • 4
  • 21
  • 25
2
votes
2 answers

How to store key-value pairs in a file that will be stored in internal memory in Android?

I have some information that needs to be stored in internal memory. I will like to store in the form of key-value pairs the way its done in SharedPreferences. I was thinking of creating JsonObject and saving and retrieving in that way. Is there any…
sunil
  • 9,541
  • 18
  • 66
  • 88
2
votes
1 answer

Converting NSString to key value pair

I have a response from server which is NSString and looks like this resp=handshake&clientid=47D3B27C048031D1&success=true&version=1.0 I want to convert it to key value pair , something like dictionary or in an array . I couldn't find any useful…
Milianoo
  • 1,476
  • 1
  • 10
  • 9
2
votes
1 answer

How to remove indexes from array, only leaving values?

I have this array that's logged like so: How can I "convert" the array to be simpler, so it outputs like this? ["Acura", "Aston Martin", ...] Thanks!
Ralph David Abernathy
  • 5,230
  • 11
  • 51
  • 78
2
votes
1 answer

Regex extraction of substrings ignoring internal character used to match

I'm matching a string of a key value pair between characters "" with "(.*?)" how can I ignore any extra " characters within the value part. example string {"1"=>"email@example.com"}
stephen
  • 33
  • 4
2
votes
3 answers

Using LINQ to find a specific value in a List

I'm trying to use LINQ to find a specific string value "ConstantA" in a List. Variable "stuff" is a type of: List> The first value in the List (StuffName) is the one that I'm looking for: How do I use LINQ to find…
ichachan
  • 637
  • 1
  • 10
  • 34
2
votes
1 answer

How to get value from key-value pair in Prolog

I have difficulty finding the way to access values from prolog key-value pairs. gas-[2, 3, 1, 1, 3] Above is an example of my pair, gas is a key, and the list is value. The reason I use this A-B format is because the term -(A, B) denotes the…
zxcisnoias
  • 494
  • 3
  • 19
2
votes
4 answers

How to find Common Keys in key value Pair which are Less than the Specified Threshold

I have a dictonary with key value pair where I want to set threshold as less than 50% for value which basically means in any of the key value pair where value pair has value less than 50% of all values we should put that key value pair in a…
Ani
  • 147
  • 2
  • 14
2
votes
0 answers

Handlebars php (LightnCandy\LightnCandy) : each keyvalue pair NULL

I use LightnCandy\LightnCandy to template handlebars in PHP. I want to print some key/value pair on my template (if you have better, thanks to show me :) ). I've try to get key value by : Classic method {{#each my_table as |val key|}} Testing…
Chenille33
  • 93
  • 1
  • 1
  • 10