We were dealing with a datasource of (int? id, string value) pairs in LINQ. The data has originated from a database where id is unique field. In the program this datasource had to be seen as a dictionary, so we have written a code like this:
(int? id, string value)
id
var dictionary = CreateIDValuePairs().ToDictionary(item => item.ID, item => item.Value);
var dictionary = CreateIDValuePairs().ToDictionary(item => item.ID, item => item.Value)
That was too simple-minded. This code compiles but crashes at runtime when there is an id == null.
id == null
Well, help warns about this behaviour, but anyway this does not make pain easier.
In our opinion this restriction is not justified and just complicates the use of Dictionaty.
Dictionaty
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u