Please help with a dictionary comprehension in LINQ, C#.

Posted by Hamish Grubijan on Stack Overflow See other posts from Stack Overflow or by Hamish Grubijan
Published on 2010-03-15T20:59:54Z Indexed on 2010/03/15 21:09 UTC
Read the original article Hit count: 154

Filed under:
|
|

Python's equivalent of what I want is:

>>> #C#: Dictionary<int, string> tempDict = ...
>>> tempDict = {i : str(i) for i in range(200000)}
>>> tempDict[5]
'5'
>>> 

The example is a bit simplified, but I can modify it myself; do not want to bother you with details of proprietary classes.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about dictionary