title: In C#, Checking string length greater than zero produces error?
body: <p>This question sounds outrageous, but VS is giving me an error when I check that a string length is greater than zero:</p>
  
  <pre><code>options[j]["pdprice"].ToString().Length &gt; 0
  </code></pre>
  
  <p>Saying:</p>
  
  <blockquote>
    <p>CS0019: Operator '>' cannot be applied to operands of type 'string' and 'int'</p>
  </blockquote>
  
  <p>Can someone please explain why I cannot check that an integer length property is greater than zero?  I even tried casting the entire thing as an int, but it still complains.</p>
  
  <p>EDIT:</p>
  
  <p>I like the answer below and will change the code.  This is the original slightly modified to "work":</p>
  
  <pre><code>newlistitem.Value = options[j][valuefield].ToString() + 
  ((options[j]["pdprice"].ToString().Length &gt; 0 ) ?  
  "/" + options[j]["pdprice"].ToString() : "" );
  </code></pre>
  
  <p>And yes, it is referencing an old DataSet.  We haven't had time to convert the solution to MVC, Linq, etc., but we are working on it.  :)</p>