How to I add a new value based on a change of value

Hi there

How to I add a new value based on a change of value?

I have this code

 foreach (var item in itemAttributes)
        {            
            string fID = GetBook("Programming");
            var attributes = from a in itemAttributes
                             where a.Description.ToLower().Contains("ID='" + fID + "'")

            SearchBookCollection values = new SearchBookCollection();
            values.AddRange(attributes.ToList());
        }

What I want is if fID are different ONLY run

values.AddRange(attributes.ToList());

Hope this makes sense?

thanks
mousemat24Asked:
Who is Participating?
 
Arthur_WoodCommented:
this line:

var attributes = from a in itemAttributes
                             where a.Description.ToLower().Contains("ID='" + fID + "'")


will never return any values.  You are converting the Description value to ALL LOWER case charaters, and then trying to find if that contains a value which includes UPPER case characters ("ID=").  Obviously that condition will never be met.

AW
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.