<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Difference between .HasValue and empty string in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714125#M22862</link>
    <description>&lt;P&gt;Hi everyone, what is the difference between&amp;nbsp;!el.LookupParameter("Company").HasValue and el.LookupParameter("Company").ToString() != "" ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;foreach (Element el in _AllElements)
{
if (!el.LookupParameter("Company").HasValue || el.LookupParameter("Company").ToString() != "" )
{
//code1
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why if I have only&amp;nbsp;!el.LookupParameter("Company").HasValue the debugger just skips the execution of code1 but if I have both conditions that's when it actually finds unfilled parameter "Company" and executes everything inside of if statement ?&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 11:32:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-10-26T11:32:59Z</dc:date>
    <item>
      <title>Difference between .HasValue and empty string</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714125#M22862</link>
      <description>&lt;P&gt;Hi everyone, what is the difference between&amp;nbsp;!el.LookupParameter("Company").HasValue and el.LookupParameter("Company").ToString() != "" ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;foreach (Element el in _AllElements)
{
if (!el.LookupParameter("Company").HasValue || el.LookupParameter("Company").ToString() != "" )
{
//code1
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why if I have only&amp;nbsp;!el.LookupParameter("Company").HasValue the debugger just skips the execution of code1 but if I have both conditions that's when it actually finds unfilled parameter "Company" and executes everything inside of if statement ?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 11:32:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714125#M22862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T11:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between .HasValue and empty string</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714412#M22863</link>
      <description>&lt;P&gt;It works very similar to normal string of C#.&lt;/P&gt;&lt;P&gt;Difference between&lt;BR /&gt;String s=null;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;P&gt;String s= "";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 13:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714412#M22863</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2021-10-26T13:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between .HasValue and empty string</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714555#M22864</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7136965"&gt;@sahin.ikbal&lt;/a&gt;&amp;nbsp;you are comparing&amp;nbsp;&amp;nbsp;"&lt;SPAN&gt;String s=null" and "!el.LookupParameter("Company").HasValue" ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;in that case the question now is what is the difference between&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;e.LookupParameter("Company") != null&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;!el.LookupParameter("Company").HasValue&lt;/LI-CODE&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 13:55:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714555#M22864</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between .HasValue and empty string</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714575#M22865</link>
      <description>&lt;PRE&gt;e.LookupParameter("Company") != null&lt;/PRE&gt;&lt;P&gt;Here the whole parameter is null, this will only come once there is no such parameter.&lt;/P&gt;&lt;P&gt;But if the parameter value type is something nullable than that null is found by HasValue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 14:01:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10714575#M22865</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2021-10-26T14:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between .HasValue and empty string</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10715739#M22866</link>
      <description>&lt;P&gt;Parameter.HasValue should be renamed. It appears to indicate a state that only exists prior to a parameter being assigned it's first value i.e. false if never used (would like to know if there are any instances otherwise). I don't know if it was meant to work that way but it is the way it appears to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably it comes from exposing some unmanaged idea that we need to check pointer actually refers to something (even that something being nothing) i.e. memory allocated before using it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So not of much use as far as I can tell and a bit dangerously named (depending on your personal philosophy of the meaning of nothing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 21:44:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/difference-between-hasvalue-and-empty-string/m-p/10715739#M22866</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-26T21:44:11Z</dc:date>
    </item>
  </channel>
</rss>

