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
1
vote
2 answers

KeyValuePair.ToString implementation details

While working on something else lately I run into a bit strange piece of code on KeyValuePair.ToString() implementation. public override string ToString() { StringBuilder stringBuilder = StringBuilderCache.Acquire(16); …
MarcinJuraszek
  • 124,003
  • 15
  • 196
  • 263
1
vote
1 answer

Create a time-based map in C

So I have a map from Key -> Struct My key will be a devices IP address and the Value(Struct) will hold a devices IP address and a time which after that amount of time has elapsed will make the key-value pair expire and so be deleted from the map. I…
cxzp
  • 652
  • 2
  • 14
  • 28
1
vote
1 answer

How to create NameValuePair list in ios 6

I am new in ios. I am working in a application in which i need to post some data in nameValuepair so I used NSDictionary to crate a name value pair but with NSDictionary there is issue on server side to parse posted data. Is there any way to create…
user2298296
  • 91
  • 1
  • 4
1
vote
3 answers

How does a Key Value Pair handle an exact match to a key that already exists?

I have a collection that I am inserting into the Dictionary and there are values that have already been entered into the KVPs. Say I already have a key of "4000" and the value comes up again, what happens to the value? Does it add the value of the…
Markpelly
  • 37
  • 1
  • 7
1
vote
4 answers

Cast a variable to a Type and call Methods

How would I go about invoking a method call for an Object after casting it to a Type? I have a KeyValuePair which stores the type of the object and the object itself. I then want to cast this object to its key type and invoke a method of that class…
Travv92
  • 791
  • 4
  • 14
  • 27
1
vote
3 answers

No Non Generic KeyValuePair class

I often use Tuple.Create on the Tuple class. Now I'm creating a KeyValuePair with: new KeyValuePair(myString, myObj) I didn't want to include the type arguments in this case because they obfuscate the…
Steven Wexler
  • 16,589
  • 8
  • 53
  • 80
1
vote
3 answers

Using KeyValuePair in VB.NET for a reverse lookup capable dictionary (example hint in C# needs converting)

I'm currently on a VB.NET project and wish to use a KeyValuePair to facilitate a reverse lookup. I've found a great example in C# here: http://www.dreamincode.net/forums/showtopic78080.htm, however I am having a small problem converting to VB.NET…
Topdown
  • 443
  • 1
  • 8
  • 17
1
vote
3 answers

How to convert this C# script to native C++?

I'm beginner in C++. Before I work with C#. Bellow is a C# script. How I can do same these things in native C++? All I need is: A list, or similar, have int-int key-value pair Can auto sort by value. If not, it must be sortable by key and it can…
1
vote
2 answers

KeyValuePairOfstringanyType, how do I declare and format this?

I have a data object in php generated from a WSDL. One variable in this data object is named " KeyValuePairOfstringanyType" of type KeyValuePairOfstringanyType[] great. How do I declare that and assign a value to it?
CQM
  • 42,592
  • 75
  • 224
  • 366
1
vote
3 answers

Java regular expression for simple key-value pairs with a suffix

Consider a set of strings like the following: Memory size = 4,194,304 KB Cache size= 32,768 K Number of cores = 8 Note =4,000,000 KB is less than 4 GB Is there a generic and not too complex Java regular expression that matches each string…
PNS
  • 19,295
  • 32
  • 96
  • 143
1
vote
4 answers

C# - Remove Key duplicates from KeyValuePair list and add Value

I have a KeyValuePair List in C# formatted as string,int with an example content: mylist[0]=="str1",5 mylist[2]=="str1",8 I want some code to delete one of the items and to the other add the duplicating values. So it would…
0
votes
1 answer

Remove a specific object from an object array, filtering by a key and value pair

Is there any quick way to remove a specific object from an object array, filtering by a key and value pair, without specifying an index number? For example, if there was an object array like so: const arr = [ { id: 1, name: 'apple' }, { id: 2,…
sekai_no_suda
  • 413
  • 4
  • 11
0
votes
0 answers

Use Pair as a key in a LinkedHashMap (Java)

I have a HashMap like this LinkedHashMap = new LinkedHashMap<>(); this map is used as cache to implement LRU (least recently used) In this cache I want to save results from functions that have no "side-effect" so for the same input they…
real_G
  • 49
  • 8
0
votes
0 answers

How to use an array containing Pair objects?

My array: private Object[] arr = new Pair[initialCapacity]; My Pair class: private static class Pair { private String key; private V value; public Pair(String key, V value) { this.key = key; this.value = value; …
Wiggiwoo
  • 1
  • 1
0
votes
2 answers

How to select duplicate value from a list in C# based on condition?

I have a list with date and Fileno as values. I need to find the duplicate date and based on that find the highest Fileno.Then add that keyvalue pair and the distinct pair to the final list. The result should be as shown below.I am able to get the…
Anju
  • 27
  • 6