简体   繁体   English

Revit API中的语句问题

[英]Statement issue in revit api

I am having a problem with the following statement. 我对以下陈述有疑问。 I was hoping some could help me? 我希望有人能帮助我吗?

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

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 请尝试在此处获取有关Parameter.StorageType值的一些信息: 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 您实际上不应该在这里使用像2这样的“魔术”数字,相反,它应该是

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 值的类型是double ,一个浮点数
  • has a value 有价值

Read the developer documentation on how the parameters work. 阅读有关参数如何工作的开发人员文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM