Omgili - forum search, search forums  
  

Discussions about tkey key

Displaying 1 - 10 out of 405 discussions.  
RSS Feed Options
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
This may appear to be a duplicate of this question , which asks "What’s the difference between SortedList and SortedDictionary ?" Unfortunately, the answers do nothing more than quote the MSDN documentation (which clearly states that there are performance...
Started by on , 3 posts by 3 people.  
This is not possible....
I try to use SortedList as much as possible because it allows me to iterate over the keys and value collections.
Retrieval of keys is comparable, but addition is much faster with Dictionaries.
That's all there is to it.
Okay - so I know it's simple to build a factory method that provides the functionality; but given that Dictionary<TKey, TValue> is IEnumerable<KeyValuePair<TKey, TValue>> , shouldn't it have a Ctor equivalent to, for example, List<...
Started by on , 3 posts by 3 people.  
Totally unofficial guess : If a constructor allowed an IEnumerable<KeyValuePair<TKey, TValue>> you would have been able to supply multiple items with the same key and what would.
Just overriding Equals in TKey does not help. public override bool Equals(object obj) { /* ... */ } ... Equals will never be called ... ... adding this doesn't help too: public override int GetHashCode() { return base.GetHashCode(); } BUT, this helps:...
Started by on , 4 posts by 4 people.  
Assuming you've defined a custom reference type as a key, you must either: always pass the same object instance into a dictionary as a key, or implement a GetHashCode() that always returns the same be used when you pass in different instances....
Ask your Facebook Friends
I'm using a Dictionary<TKey, TValue> and I'm getting some odd, though somewhat understandable behaviour in my tests. No matter the order I add entries to the dictionary when I call Dictionary.Keys the keys are returned in the order specified by ...
Started by on , 3 posts by 3 people.  
MSDN explicitly....
Once you add enough items into the table and force sufficient rehashes the keys will not be ordered.
This is just a coincidence that is likely due to your sample size or GetHashCode implementation .
You cannot rely on this behavior.
The MSDN explains Lookup like this: A Lookup<TKey, TElement> resembles a Dictionary<TKey, TValue> . The difference is that a Dictionary<TKey, TValue> maps keys to single values, whereas a Lookup<TKey, TElement> maps keys to collections...
Started by on , 5 posts by 5 people.  
It lets you group items together by a key, but then access them via that key in an efficient manner (rather than just iterating over them all); } } } I haven't successfully used it before....
It's a cross between an IGrouping and a dictionary.
I've been trying to write an extension method to mimic List.RemoveAll(Predicate). So far I've got this: public static void RemoveAll<TKey,TValue>(this Dictionary<TKey,TValue> dict, Predicate<KeyValuePair<TKey,TValue>> condition...
Started by on , 5 posts by 5 people.  
Try the following public static void RemoveAll<TKey,TValue>(this Dictionary<TKey,TValue> dict, Func<KeyValuePair<TKey,TValue>,bool> condition allocate a list for the items ....
To modify the Dictionary inline.
Hi, The names TKey and TValue in a dictionary are confusing me. Are they named with that convention for a reason or could they have named it anything? i.e. if I create a generic, do I have to use some sort of naming convention also?
Started by on , 8 posts by 8 people.  
A dictionary is....
Hence TKey is the generic type of the "key", and TValue of the value .
I.e., the T prefixes the purpose.
TKey is the key's type; TValue is the value 's type.
To differenciate between the different types.
The IDictionary<TKey, TValue> in .NET 4 / Silverlight 4 does not support covariance, i.e. I can't do a IDictionary<string, object> myDict = new Dictionary<string, string>(); analog to what I can do with IEnumerable<T> s now. Probably...
Started by on , 4 posts by 4 people.  
Will it ever come, maybe.
To wit: myDict.Add(key, value); and TValue value = myDict[key]; So is that a bug or a feature? It's by design.
TKey, TValue> is used in both input and output positions.
Given the following stack trace: MESSAGE: Value cannot be null.Parameter name: key SOURCE: mscorlib TARGETSITE: Void ThrowArgumentNullException(System.ExceptionArgument) STACKTRACE: at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument...
Started by on , 6 posts by 6 people.  
As the built-in Dictionary class.
This exception happens if the dictionary key is null .
It looks more like that your IDictionary argument has an item with a Key parameter which is null in the framework.
Hi, I understand that a dictionary is not an ordered collection and one should not depend on the order of insertion and retrieval in a dictionary. However, this is what I noticed: Added 20 key value pairs to a Dictionary Retrieved them by doing a foreach...
Started by on , 7 posts by 7 people.  
This is because the Dictionary<K,V> implementation uses the hash code of the key object....
The order in which to the same value.
As a KeyValuePair<(Of <(TKey, TValue>)>) structure representing a value and its key.
Page: 1   2   3   4   5   6   7   8   9   10  
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost