Correctly get entries

This commit is contained in:
yankejustin 2015-06-02 13:50:56 -04:00
parent 59599759be
commit 172359262a
1 changed files with 2 additions and 3 deletions

View File

@ -86,14 +86,13 @@ public static IEnumerable<string> GetFormattedKeyValues(this RegistryKey key)
{
if (key != null)
{
foreach (var k in key.GetValueNames().Where(keyVal => !keyVal.IsNameOrValueNull(key))
.Select(keyVal => key.GetValueSafe(keyVal)))
foreach (var k in key.GetValueNames().Where(keyVal => !keyVal.IsNameOrValueNull(key)))
{
// Less-likely, but this will ensure no empty items if an exception was thrown
// when obtaining the value.
if (string.IsNullOrEmpty(k))
{
yield return string.Format("{0}||{1}", k, key.GetValue(k));
yield return string.Format("{0}||{1}", k, key.GetValueSafe(k));
}
}
}