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

Posted on 2011-10-27
Last Modified: 2012-06-21
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();

What I want is if fID are different ONLY run


Hope this makes sense?

Question by:mousemat24
    1 Comment
    LVL 44

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now