diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-07-20 06:45:47 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-07-20 06:45:47 +0400 |
commit | f8ca3638867ae338510fe06db82f64f4c85e1854 (patch) | |
tree | 21ccdf10c88b15a5cd7ab2af88a9b09a8e7ef65e /mcs/class/System.Core/System.Linq/Lookup.cs | |
parent | 0449ef109f5bf7ce3b156aa8873dd1fd8b9c7f5c (diff) |
2009-07-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Lookup.cs: when there are no matching elements, return an empty
enumerable. Fixes bug #523386.
svn path=/trunk/mcs/; revision=138190
Diffstat (limited to 'mcs/class/System.Core/System.Linq/Lookup.cs')
-rw-r--r-- | mcs/class/System.Core/System.Linq/Lookup.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mcs/class/System.Core/System.Linq/Lookup.cs b/mcs/class/System.Core/System.Linq/Lookup.cs index 0398ad6a53a..19affc8433d 100644 --- a/mcs/class/System.Core/System.Linq/Lookup.cs +++ b/mcs/class/System.Core/System.Linq/Lookup.cs @@ -44,7 +44,11 @@ namespace System.Linq { } public IEnumerable<TElement> this [TKey key] { - get { return groups [key]; } + get { + if (groups.ContainsKey (key)) + return groups [key]; + return new TElement [0]; + } } internal Lookup (Dictionary<TKey, List<TElement>> lookup) |