contains function in asp.net
<p>i am trying to increase count by comparing two strings using Contains function.
My code is,</p>

<pre><code>  int count = 0;
string strSize = "";
 for (int i = 0; i &lt; dts.Rows.Count; i++)
    {
    strSize += dts.Rows[i]["sizeid"].ToString() + ",";
    }


 if (strSize.Length &gt; 0)
  strSize = strSize.Substring(0, strSize.Length - 1);
// After executing  strSize="3,4,5,10"

if (strMainSize.Length &gt; 0)
    strMainSize = strMainSize.Substring(0, strMainSize.Length - 1);
// After executing  strMainSize ="1,2,3,4,5,10,45"

   strM = strMainSize.Split(',');


 for (int s = 0; s &lt; strM.Length; s++)
   { 
       if (strSize.Contains(strM[s]))
         {
            count++;
            chkSize.Items.FindByValue(strM[s]).Selected = true;
         }
   }
var totalCount = count;
</code></pre>

<p>After executing this,totalCount should be equal to 4 but it is giving me 5,means first time when it is checking condition for strSize.Contains(strM[s]) it is getting true instead of false.
Can anybody tell me why this is happening.</p>

<p>Other thing when i am doing same in other application it is working fine.</p>

<p>code i wrote is,</p>

<pre><code> int count=0;
        string[] str = { "3", "4", "5", "10"};
        string[] strM = {"1","2","3","4","5","10","45","50" };
        for (int s = 0; s &lt; strM.Length; s++)
        {

            var stM = strM[s];
            if (str.Contains(strM[s]))
            {
                count++;
                chkSize.Items.FindByValue(strM[s]).Selected = true;
            }
        }

        int totalCount = count;
</code></pre>

<p>here o/p:totalCount=4.
Can anybody tell me the difference between two.</p>
