[英]Can Native generated value-type identifier be null in NHibernate?
[英]Determine if generated type is value-type
我有一些通过CodeDOM创建的类型。 有没有办法确定给定属性的类型是否为值类型?
对于在mscorlib中声明的那些,我很容易调用Type.GetType
,然后检查Type.IsValueType
。 但是对于我的DOM中的那些类型,我们不能使用这种方法,因为没有程序集来加载类型。
var codeType = code.Types[0].Members[0];
bool isValueType = // get the runtime-type to determine if it is value-type or not
CodeTypeDeclaration.IsStruct
属性,尽管它的名称,确实这样做 - 确定类型是否是值类型。 请参阅此处的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.