Question: I have a problem trying to add a set of Keys to a dictionary of string and a list of bool, and below is my Code:

```
    private Dictionary<string, List<bool>> _properties = new Dictionary<string, List<bool>>();

private void Getconfiguration(PropertyInfo[] properties, object vCapabilities, object fCapabilities, object mCapabilities, List<string> list, string capabilityPath)
        {
            var propertyValue = new List<bool>();

        foreach (var propertyInfo in properties)
        {
            var vValue = propertyInfo.GetValue(vCapabilities, null);
            var fValue = propertyInfo.GetValue(fCapabilities, null);
            var mValue = propertyInfo.GetValue(mCapabilities, null);

            var type = GetMemberType(propertyInfo);

            if (type != typeof(bool))
            {
                GetPropertiesForMembers(propertyInfo.PropertyType.GetProperties(), vValue, fValue, mValue, list, Path);
            }

            propertyValue.Add(vValue.ToBool());
            propertyValue.Add(fValue.ToBool());
            propertyValue.Add(mValue.ToBool());

            _properties.Add(propertyInfo.Name, propertyValue);
        }
        var test = _properties;
    }

```

What I am getting in my value test is a set of name but the number in the `propertyValue` is equal to number of key\*3(Key times 3)  
 Is there a way of removing duplication so that each Key have three values only?  

For example if I have 5 keys then the `propertyValue` will be 15 for each key instead of three.

Thanks

Answer: 
A new instance of `propertyValue` should be created inside foreach for each iteration!
This should work:

```
private Dictionary<string, List<bool>> _properties = new Dictionary<string, List<bool>>();

private void Getconfiguration(PropertyInfo[] properties, object vCapabilities, object fCapabilities, object mCapabilities, List<string> list, string capabilityPath)
        {          
           foreach (var propertyInfo in properties)
           {
            var propertyValue = new List<bool>();

            var vValue = propertyInfo.GetValue(vCapabilities, null);
            var fValue = propertyInfo.GetValue(fCapabilities, null);
            var mValue = propertyInfo.GetValue(mCapabilities, null);

            var type = GetMemberType(propertyInfo);

            if (type != typeof(bool))
            {
                GetPropertiesForMembers(propertyInfo.PropertyType.GetProperties(), vValue, fValue, mValue, list, Path);
            }

            propertyValue.Add(vValue.ToBool());
            propertyValue.Add(fValue.ToBool());
            propertyValue.Add(mValue.ToBool());

            _properties.Add(propertyInfo.Name, propertyValue);
        }
        var test = _properties;
    }

```
You need to move the list initialisation into the loop.