Mercurial > repos > IBBoard
comparison Collections/DictionaryToArrayConverter.cs @ 13:6b762694f051
Check size of dictionary so that we don't have to get the values when we've got an empty dictionary
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 06 Jan 2009 19:27:47 +0000 |
parents | 465b672e9682 |
children |
comparison
equal
deleted
inserted
replaced
12:465b672e9682 | 13:6b762694f051 |
---|---|
39 if (dictionary == null) | 39 if (dictionary == null) |
40 { | 40 { |
41 return null; | 41 return null; |
42 } | 42 } |
43 | 43 |
44 VALUE_TYPE[] col = new VALUE_TYPE[dictionary.Count]; | 44 int entryCount = dictionary.Count; |
45 dictionary.Values.CopyTo(col, 0); | 45 VALUE_TYPE[] col = new VALUE_TYPE[entryCount]; |
46 | |
47 if (entryCount > 0) | |
48 { | |
49 dictionary.Values.CopyTo(col, 0); | |
50 } | |
51 | |
46 return col; | 52 return col; |
47 } | 53 } |
48 } | 54 } |
49 } | 55 } |