0

I am having a problem with the following statement. I was hoping some could help me?

if (parameter != null && parameter.StorageType == 2 && parameter.HasValue)

Arend
  • 3,741
  • 2
  • 27
  • 37
  • Welcome to Stackoverflow, Could you describe (1) what you're trying to achieve and (2) the problem you're having? (e.g. Error, or unexpected result, what does work. what does not work). Also we use tags here at stackoverflow, that can help you bring your post to the attention of the right people, it would be helpful to for example tag revit, the tag of revit api, revit, and C# (I believe revit is using C# right?) – Arend Feb 05 '14 at 18:07

1 Answers1

0

Try here for some information on the Parameter.StorageType values: http://spiderinnet.typepad.com/blog/2011/04/parameter-of-revit-api-5-parametertype-and-storagetype.html

You shouldn't really use a "magic" number like 2 here, instead, it should probably be

parameter.StorageType == `StorageType.Double`

Basically, what the line is doing, is making sure, that the parameter

  • was retrieved
  • the value's type is a double, a floating point number
  • has a value

Read the developer documentation on how the parameters work.

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
  • @ChristopherF, you're welcome. Don't forget to "accept" the correct answer - some of us like the fake internet points ;-) – Daren Thomas Feb 06 '14 at 16:41