Background
In our last adventure, I was attempting to properly show a Dictionary<Foo, Bar<T>>. Thanks to the helpful answers in that post, I realize I had been going about it in the wrong way.
Problem
In today's adventure, I've been trying to get two specific properties from the List<T> in the last question to display. Each List h...
I've got the following piece of JSON:
[{
"name": "numToRetrieve",
"value": "3",
"label": "Number of items to retrieve:",
"items": {
"1": "1",
"3": "3",
"5": "5"
},
"rules": {
"range": "1-2"
}
},
{
"name": "showFoo",
"value": "on",
"label": "Show foo?"
},
{
"name...
I can't get to the bottom of this error, because when the debugger is attached, it does not seem to occur. Below is the code.
This is a WCF server in a Windows service. The method NotifySubscribers is called by the service whenever there is a data event (at random intervals, but not very often - about 800 times per day).
When a Windows...
Is there a way to retrieve words randomly from the built in Dictionary through the SDK?
I can provide my own list of words but using the built in Dictionary allows for easy localization.
...
I have a dictionary of values read from 2 fields in a database: a string field and a numeric field. The string field is unique so that is the key of the dictionary.
I can sort on the keys, but how can I sort based on the values?
Note: I have read this post 72899 and probably could change my code to have a list of dictionaries but since...
I'm looking for the most efficient way to figure out a change amount (Quarters, dimes, nickels, and pennies) from a purchase amount. The purchase amount must be less than $1, and the change is from one dollar. I need to know how many quarters, dimes, nickels, and pennies someone would get back.
Would it be best to set up a dictionary?
...
Does anyone have any idea what the practical differences are between the System.Collections.Specialized.StringDictionary object and System.Collections.Generic.Dictionary?
I've used them both in the past without much thought as to which would perform better, work better with Linq, or provide any other benefits.
Any thoughts or suggestio...
I have a collection of MyClass that I'd like to query using linq to get distinct values, and get back a Dictionary as the result - but can't figure out how I can do it any simpler than I'm doing below. Does anyone have some cleaner code that I can use to get the Dictionary as my result?
var desiredResults = new Dictionary<string, s...
var _pool = new Dictionary<Type, Dictionary<EntityIdType, Object>>();
public IEnumerable<EntityType> GetItems<EntityType>()
{
Type myType = typeof(EntityType);
if (!_pool.ContainsKey(myType))
return new EntityType[0];
//does not work, always returns null
// return _pool[myType].Values; as IEnumerable<EntityType...
I am trying to get to speed on the use of dictionaries. I spent three hours last night searching the web for examples similar to some of the things I am trying to do. For example, suppose I have two dictionaries (actually I have two lists of dictionaries).
d1={key1:1, key2:2}
d2={key1:1, key2:'A', key4:4}
I want to update d1 so it...
I'm perusing (considering writing my own thread safe dictionary) I found the following implementation.
http://devplanet.com/blogs/brianr/archive/2008/09/26/thread-safe-dictionary-in-net.aspx
It looks pretty good generally, but there's one thing that confuses me.
The following:
Cannot enumerate a threadsafe dictionary. Instead, enum...
If I want to use objects as the keys for a Dictionary, what methods will I need to override to make them compare in a specific way?
Say I have a a class which has properties:
class Foo {
public string Name { get; set;}
public int FooID {get; set;}
...
}
And I want to create a:
Dictionary<Foo, List<Stuff>>
I want Foo ob...
I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists:
d1 = {0:['11','18','25','38'],
1:['11','18','25','38'],
2:['11','18','25','38'],
3:['11','18','25','38']}
d2 = {0:['05','08','11','13','16','25','34','38','40', '43'],
1:['05', '...
I need to store a lookup table as an instance member in one of my classes. The table will be initialized when the object is constructed. Each "row" will have 3 "columns":
StringKey (e.g., "car")
EnumKey (e.g., LookupKeys.Car)
Value (e.g, "Ths is a car.")
I want to pick the data structure that will yield the best performance for doin...
I have found that datagrid columns can be dynamically created and bound in Silverlight. However I can't find a way to bind data to those columns.
If I try to bind any type of object with AutoGenerateColumns = true, then the names of each property of the object get added as columns and the object information is displayed in the grid in a...
I am working on a program that (among other things) reads a CSV file in (it gets stored as an array of dicts in the form [{col1:data1a,col2:data2a},{col1:data1b,col2:data2b}] ). For each row, as part of other processing, I need to remap those keys to user entered values, which are provided in another dict so they can be used as parameter...
I'm writing an assembler for a microprocessor I'm creating using lex/yacc.
I'd like to implement labels in my assembler code, and I thought a good way to do this would be to have a dictionary of labels in the form {name:line#}. I could then check when inserting a label, if it's already defined, its an error.
So how can I use a dictiona...
Hi Everybody,
From MySQL query I get data which I put into a dictionary "d":
d = {0: (datetime.timedelta(0,
25200),), 1: (datetime.timedelta(0,
25500),), 2: (datetime.timedelta(0,
25800),), 3: (datetime.timedelta(0,
26100),), 4: (datetime.timedelta(0,
26400),), 5: (datetime.timedelta(0,
26700),)}
I have a list "m" with...
First, I'm new to Python, so I apologize if I've overlooked something, but I would like to use dict.fromkeys (or something similar) to create a dictionary of lists, the keys of which are provided in another list. I'm performing some timing tests and I'd like for the key to be the input variable and the list to contain the times for the r...
Hello. I am wrapping up an application where I am using a lot of Dictionary classes to store Function and Action delegates. I am now refactoring my project a bit and cleaning code. My question is where do or would you put your Dictionary classes in your project structure? Right now, they are located within the calling class source files ...