public static VariableCollection GetProjectVariables(this List<ResourceVariableSetPair> variableSets, ProjectResource project, Dictionary<ScopeField, ScopeValue> scopeDictionary) { VariableCollection variablesPaired = new VariableCollection(); foreach (ResourceVariableSetPair variableSetPair in variableSets) { foreach (VariableResource variableResource in variableSetPair.VariableSet.Variables) { if (scopeDictionary != null && !variableResource.Scope.IsApplicableTo(scopeDictionary)) { continue; } variablesPaired.AddOrUpdate(variableResource, variableSetPair.Resource); } } return variablesPaired; }