0
public class RegistryTableItem
{      
  public int Root { get; set; }//assume possible values are 0,1,2,3      
  public string Name { get; set; }     
  public string Component_ { get; set; }
 }

List<RegistryTableItem> _all_RegistryTable_items = //assume you have data in this;

 var result= from regitems in MsiReader._all_RegistryTable_items
             group regitems by regitems.Component_;
             having (root==1 || root==3) && (root==0 || root==2);//fix this line

The rule is rootcolumn values in each Componentgroup should be 0,2 or 1,3 (Only these combinations are valid groups). I want items which do not pass this rule.

eg: if a component_x has RegistryTableItems with distinct root values as 1,0 or 2,3 or 1,2,3 etc it should come in the result since they are not part of the valid 2 groups.


You want an AND comparison. I am assuming that you want to make sure that only a value of 0 or 1 is passed to the script.

if ($newsletter != "0" && $newsletter != "1") {
    $error_message .= 'Invalid newsletter?<br />';
}

Since 0 != 1 either of side of your OR condition was true. So this always passed.

4

1 に答える 1